Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to connect the Amazon Echo to your OpenHAB 2 System.
I love the amazon echo and think it is an awesome device that makes controlling smart devices really easy with voice control. You can be in another room and yell to alexa and tell her to turn on a device for you. In this video we will be connecting alexa to our openhab 2 system so she can control our openhab items. The only thing we are going to need for this video is the Amazon Echo device, I will leave a link to all the Amazon Echo devices in the description to my website but, personally I have only used the Echo Dot. For this guide I am going to assume you already have the device installed and it is running perfectly using the setup instructions Amazon provides and you can control it and can access it from the Alexa app. I am also going to assume that you have a items file and a rules file. If you do not then go take a look at my video where I explain how to setup the configuration files in openHAB. I will not be making two separate videos using Mac and PC because the process is really similar the only difference is that on mac you use Terminal to ssh and on PC you use putty.
1. The first thing we have to do is ssh into the OpenHAB Server.
I recommend having my website guide open when you do this so that way you can just copy and paste commands.
2. Now type in sudo nano /etc/openhab2/items/home.items
and press enter.
3.Now we are going to add the tags that the Amazon Echo supports to the items. The tags go right before the bindingconfig.
The amazon echo supports the following tags:
[ “Switchable” ]
This tag is used with the Switch item type, Dimmer item type, Color item type, as well as the Rollershutter item type, but you would not use this for a light that is what the next one is for.
[ “Lighting” ]
This tag is used for lights with the Switch item type, Dimmer item type, and the Color item type.
[ “CurrentTemperature” ]
This tag would be used with a device that reports temperature and has the Number item type.
[ “Thermostat” ]
This tag is used with an item that has a Group item type and has the following devices in the Group
[ “CurrentTemperature” ]
[ “TargetTemperature” ]
[ “homekit:HeatingCooling” ]
I personally do not use the tags associated with the Thermostat and have never used them but if you want more information on them then check it out the GitHub, link is on my website, which is in the description.
I just use the Lighting and the Switchable one, in the future we may be using the Current Temperature one.
Alright let's take a look at my items file because I have already put in the tags. As you can see I put the Switchable tag next to the items that are the Switch item type but are not lights. I also put the switchable tag into the GarageDoorShutterDummy items because they are of the Rollershutter item type. Here is the complete item:
Rollershutter GarageDoorShutter1Dummy "Garage Door 1" <garagedoor> [ "Switchable" ]
I created a dummy switch for the garage doors because chamberlain myq does not like the command it receives when the amazon echo talks to it so I created the dummy Rollershutters as a sort of Middleman to handle the requests. I will talk more about this later. You can also see I used the Lighting tag for the two light switches. If you guys have any questions on these tags leave them in the comments because chances are someone else probably has it too.
4. Anyway once all your tags are in place, press control x then y and enter to save.
Now we have to address the Rollershutter items because when the echo sends a command it uses percents so let’s fix it. This step is optional and only if you have a Rollershutter item that needs on and off or up and down instead of percents.
5. Type in sudo nano /etc/openhab2/rules/home.rules
and press enter. Then type in the following:
// Control Garage Door 1 With Voice Sends ON or OFF Depending On Percentage
rule "Garage Door 1 Voice Control"
Item GarageDoorShutter1Dummy received command
if (receivedCommand < 50)
I pasted it in twice and modified it because I have two garage doors. All this rule is doing is taking the percent from the dummy items and then either sending the on or off command to the device. If your device requires up or down then change the ON to UP and OFF to DOWN.
6. Now press control x then y and enter to save.
Great! The items are now ready, so the next thing we are going to do is connect the Amazon echo.
7. So grab your mobile device that already has the Alexa app installed and open the app.
8. First press the three lines at the top left to bring up the menu.
9. Then press skills.
10. In the search type in openHAB.
11. Click on the openHAB skill.
12. Then click enable.
13. It will open up a web browser page, so type in your myopenhab.org username and password and press sign in.
14. It will load a new page, press allow.
15. Once that is finished scroll up and press the done button.
16. It will then ask you if you want to discover devices, click on the Discover Devices button.
It will now look for the OpenHAB items. Once it finished then it should have found all of your openHAB items and they should all be listed there. That is it! The amazon echo now has access to all your devices and you can control them with voice commands!
Let’s test it.
“Alexa, turn on MK Light”
“Alexa set Garage Door 1 to 0%”
“Alexa, turn on Sprinklers Zone 1”
Great! The device is connected and working! Now we can control our openHAB items with voice commands! Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum where you have a better chance of it getting answered. Good Bye!