Introduction: Control Raspberry Pi GPIO Using Amazon Echo (Fauxmo)
This project covers controlling Raspberry Pi GPIO using an Amazon Echo.
It uses Fauxmo which enables the RPi to pretend as a WeMo device. Fauxmo is a Python 3 module that emulates Belkin WeMo devices for use with the Amazon Echo.
To get a confirmation of change in state for GPIO you either look at the terminal in which you will run the code or use this instructable to connect GPIO ( for this project 16-26) to an LED for visual check.
Inspired by Home Automation With Amazon Echo Voice Control by FabricateIO
Step 1: Setup and Test
You will need an Amazon Echo, Raspberry Pi ( I am using a RPi 3 Model B) and copy of source code.
- Download a copy of the source code in your RPi 'home' (~/)
git clone https://github.com/kanesurendra/echo-pi.git
- Move to source directory:
- Execute the script using:
- Say to your Echo : "Alexa, discover devices"
Each GPIO is registered as a independent device and can be controlled separately.
- To change a state of GPIO say : "Alexa, turn on gpio21" or "Alexa, turn off gpio21
Step 2: Summarizing ...
Although this allows you to control individual GPIO's, by experimentation found that it allows only about 9-10 devices (GPIO's) to be discovered. The Echo discovery ends in 20 secs; before the script can respond to discovery if all 26 gpio pins are included.
Hence in the above source code only the gpio16 - gpio26 are added as devices and can be controlled.
Looking for a fix or alternative ....
MarcA88 made it!
We have a be nice policy.
Please be positive and constructive.
Hi, I get the folowing error:
File "/home/pi/Desktop/echo-pi-master/gpio-control.py", line 66
print "State", state, "on ", name, "from client @", client_address, "gpio port: ",gpio_ports[str(name)]
SyntaxError: invalid syntax
how can I resolve this?