Last month, Amazon released the Echo - a small cylinder capable of powerful voice recognition.
The Echo itself is closed source. But once you figure out the Echo's secrets, it becomes an incredibly powerful tool for voice control, enabling you to control anything in your home or apartment via voice without having to worry about the complexities of the human voice. (see: how to do voice control pre-Echo - hint: it's MUCH harder)
In this Instructable, I'll cover how to use the Amazon Echo to control any device via wifi or MQTT.
All you need is:
Difficulty: You'll need to know a little bit of Python programming to understand the examples.
Time required: 10 - 30 minutes from unboxing to Alexa.
Note: This Instructable is currently Linux-only. Let us know if you'd like it on other platforms - if there's enough interest, we'll look into it!
With your Echo up and running, let's talk hacking and home automation.
Specifically, we're about to create a server that pretends to be a WeMo device.
The Echo integrates with the WeMo home automation protocol - simply say "Alexa, discover my devices" and it'll search the local network for WeMo devices. So let's give it a device to discover!
sudo apt-get install python-pip ; sudo pip install requests
3. Extract the zip file
unzip master.zip -d echo
4. Move to the newly created echo folder
5. Start the server - you should see some debugging text indicating the server has started polling.
6. Say to your Echo "Alexa: discover my devices". She'll take a few seconds to find the new device. If she doesn't find it the first time, try killing and restarting the process and discovering devices again.
7. Now try it out! Say, "Alexa: turn off device", or "Alexa, device on". You'll see True or False for on/off, along with the Echo's IP address.
The Echo can also send commands via the Amazon cloud, using their new service called Lambda. This is a convenient way to get started with the Echo, but not great for home automation. It requires that every command include the name of the program, ie "Alexa, ask HOME to turn on the lights", and it also involves a network round trip to distant servers, which slows down the response time.
What we really want is to control local devices locally, without the prefix - ie "Alexa, turn on the lights" - which is why I'm using the WeMo protocol.