HouseBot and Amazon Echo
Posted: Sun Oct 11, 2015 4:54 pm
It is possible to have your Amazon Echo control HouseBot. There is no native support (EDIT: There is now a native Alexa Smart Home Skill for HouseBot. Look for it in your Alexa app ) for this in HouseBot, however, due to a hack that makes a running piece of software look like an automation bridge, it's possible to trick the system into working. The setup is a little convoluted, but if you're a die-hard DIYer, it should be fun.
The steps below will build this out from HouseBot to Echo.
Create External Control Device
Create an External Control Device in HouseBot. Specify a unique port for this device. Do NOT use the ASCII protocol. Password is optional (not used in this example). External control devices are an easy and flexible way to control HouseBot from other systems.
Configure Webserver
Configure a webserver (either running on the HouseBot server machine, or on a machine that has network access to the HouseBot server) to use the HB_Control program via CGI. The online help for the External Control Device goes into more specifics on the setup, but much of the setup will depend on the webserver you are using. Essentially, you need a URL that points to the webserver to execute HB_Control.exe (or HB_Control.cgi, if you rename it).
Test this setup before going any further. You need to understand the URL format to fully configure the system at the end, so this will give you a good opportunity to make sure the webserver/cgi and external control device is setup correctly.
Generally, you should be able to enter a URL such as the one below and have it change the value of a Property in HouseBot.
Note: be sure to encode the url correctly. For example, spaces in device and property names should be replaced with %20.
You can use any of the different control options that the external control offers. For example, you could also execute a Task by creating a device in the echo bridge and using the On and Off URLs to call different execute task urls.
Install the Amazon Echo Bridge
The source and setup information for the bridge can be found in GitHub. The readme says that there is a pre-built jar file, but it's not in the current repository. I had to build it with Maven following the instructions in the readme. You will need to make sure you have Java installed to run it and the JDK to build it.
Build the jar file on the machine that is running HouseBot. It can run on any machine on the network, but to keep things simple (and follow these setup instructions) put it on the HouseBot machine.
Create a batch/command file (and add it to the startup group) to run the Echo Bridge with the following command.
Note that the actual .jar filename may be different depending on the version of source that you are using.
--upnp.config.address should be set to the IP address of the machine that it is running on.
--server.port can be set to any available port.
Configure Bridge
After the Echo Bridge process has started and fully initialized, you can enter the URL below to access the device settings for the bridge.
You can substitute 'localhost' with the IP of the machine that the process is running on if you are not running a browser on the same machine.
This is the configuration page where the associations between the device name that you will ask Alexa/Echo to control and the URLs that will execute the action are setup. It only supports Off and On (and Dim) commands, but you can be a little creative and do anything that the External Control Device supports.
For example, to turn on the 'Foyer Light' (assuming you have a Device setup in HouseBot named 'Foyer Light'), you would enter Foyer Light in the Name field. The On URL would be something like:
The Off URL would be something like:
These should be the same URL formats that were tested with the webserver after the CGI was setup.
Test each of the URLs using the buttons on the configuration page to make sure they work as expected. Click the Add Device button to add the device to the bridge. Do this again for each device you want to be able to control using the Echo.
Discover Devices
After all of the devices have been setup in the bridge, have the Echo re/discover the devices by saying "Alexa, discover my devices" (or by using the app). After the discovery process is complete, you can control the devices. For example, to turn on the Foyer Light, you would just say "Alexa, turn on the Foyer Light".
There are a lot of technical details in this post, and it's possible that I forgot things or copied something down wrong. I realize that with the different processes, IP & Ports, URLs, etc., it can be confusing to setup initially. If you have any questions, feel free to ask in this post.
The steps below will build this out from HouseBot to Echo.
Create External Control Device
Create an External Control Device in HouseBot. Specify a unique port for this device. Do NOT use the ASCII protocol. Password is optional (not used in this example). External control devices are an easy and flexible way to control HouseBot from other systems.
Configure Webserver
Configure a webserver (either running on the HouseBot server machine, or on a machine that has network access to the HouseBot server) to use the HB_Control program via CGI. The online help for the External Control Device goes into more specifics on the setup, but much of the setup will depend on the webserver you are using. Essentially, you need a URL that points to the webserver to execute HB_Control.exe (or HB_Control.cgi, if you rename it).
Test this setup before going any further. You need to understand the URL format to fully configure the system at the end, so this will give you a good opportunity to make sure the webserver/cgi and external control device is setup correctly.
Generally, you should be able to enter a URL such as the one below and have it change the value of a Property in HouseBot.
Code: Select all
http://192.168.1.2:8000/cgi-bin/HB_Control.cgi?I=127.0.0.1&O=9876&C=SPV&D=Hall%20Light&P=Power%20State&V=On
Webserver IP:Port/path /HB Control EXE?HB Control Parameters (below)
I = HouseBot server IP address
O = Port configured in External Control Device (step 1)
C = SPV (Set Property Value). Other actions can also be used
D = Device to control
P = Property of Device to control
V = Value to set
You can use any of the different control options that the external control offers. For example, you could also execute a Task by creating a device in the echo bridge and using the On and Off URLs to call different execute task urls.
Install the Amazon Echo Bridge
The source and setup information for the bridge can be found in GitHub. The readme says that there is a pre-built jar file, but it's not in the current repository. I had to build it with Maven following the instructions in the readme. You will need to make sure you have Java installed to run it and the JDK to build it.
Build the jar file on the machine that is running HouseBot. It can run on any machine on the network, but to keep things simple (and follow these setup instructions) put it on the HouseBot machine.
Create a batch/command file (and add it to the startup group) to run the Echo Bridge with the following command.
Code: Select all
java -jar "<path to jar>\amazon-echo-bridge-0.2.1.jar" --upnp.config.address=192.168.1.100 --server.port=8081
--upnp.config.address should be set to the IP address of the machine that it is running on.
--server.port can be set to any available port.
Configure Bridge
After the Echo Bridge process has started and fully initialized, you can enter the URL below to access the device settings for the bridge.
Code: Select all
http://localhost:8081/configurator.html
This is the configuration page where the associations between the device name that you will ask Alexa/Echo to control and the URLs that will execute the action are setup. It only supports Off and On (and Dim) commands, but you can be a little creative and do anything that the External Control Device supports.
For example, to turn on the 'Foyer Light' (assuming you have a Device setup in HouseBot named 'Foyer Light'), you would enter Foyer Light in the Name field. The On URL would be something like:
Code: Select all
http://192.168.1.100:8000/cgi-bin/HB_Control.cgi?I=127.0.0.1&O=9876&C=SPV&D=Foyer%20Light&P=Power%20State&V=On
Code: Select all
http://192.168.1.100:8000/cgi-bin/HB_Control.cgi?I=127.0.0.1&O=9876&C=SPV&D=Foyer%20Light&P=Power%20State&V=Off
Test each of the URLs using the buttons on the configuration page to make sure they work as expected. Click the Add Device button to add the device to the bridge. Do this again for each device you want to be able to control using the Echo.
Discover Devices
After all of the devices have been setup in the bridge, have the Echo re/discover the devices by saying "Alexa, discover my devices" (or by using the app). After the discovery process is complete, you can control the devices. For example, to turn on the Foyer Light, you would just say "Alexa, turn on the Foyer Light".
There are a lot of technical details in this post, and it's possible that I forgot things or copied something down wrong. I realize that with the different processes, IP & Ports, URLs, etc., it can be confusing to setup initially. If you have any questions, feel free to ask in this post.