2016:ha:control_openhab_with_alexa
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
2016:ha:control_openhab_with_alexa [2016/05/11 13:23] – 75.177.137.2 | 2016:ha:control_openhab_with_alexa [2016/05/11 16:45] (current) – [CONTROL OPENHAB ITEMS USING Alexa] 75.177.137.2 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== CONTROL OPENHAB ITEMS USING THE AMAZON ECHO ===== | + | ===== CONTROL OPENHAB ITEMS USING Alexa ===== |
+ | Original blog is here: | ||
+ | * {{: | ||
==== INTRODUCTION ==== | ==== INTRODUCTION ==== | ||
Having a digital personal assistant, like Jarvis from Iron Man, is the ultimate geek dream. | Having a digital personal assistant, like Jarvis from Iron Man, is the ultimate geek dream. | ||
Line 17: | Line 19: | ||
==== STEP 1: RUN THE AMAZON ECHO HA BRIDGE ==== | ==== STEP 1: RUN THE AMAZON ECHO HA BRIDGE ==== | ||
Okay, enough beating around the bush. Let’s get into it! The first thing we need to do is run our Amazon Echo HA Bridge. | Okay, enough beating around the bush. Let’s get into it! The first thing we need to do is run our Amazon Echo HA Bridge. | ||
+ | {{: | ||
+ | Then, you’ll want to enter this command in the command prompt window. | ||
+ | |||
+ | < | ||
+ | java -jar amazon-echo-bridge-0.1.2.jar --upnp.config.address=192.168.1.88 | ||
+ | </ | ||
+ | |||
+ | Warning: If you’re running the Bridge on the same PC as your OpenHAB server, you’ll probably need to change the port that it listens on. This is because OpenHAB and the Echo HA Bridge both default to port 8080. | ||
+ | To change the port the Echo HA Bridge is listening on, add this flag to the end of the command: | ||
+ | < | ||
+ | –server.port=< | ||
+ | </ | ||
+ | {{: | ||
+ | After you run the command, there will be a bunch of output which you can ignore unless you run into issues. | ||
+ | {{: | ||
+ | ===== STEP 2: LOAD CONFIGURATION DATA INTO THE AMAZON ECHO HA BRIDGE ===== | ||
+ | |||
+ | This is where the Postman Chrome extension comes into handy. | ||
+ | |||
+ | When you open Postman, you need to make sure the settings are correct. | ||
+ | < | ||
+ | http://< | ||
+ | </ | ||
+ | and have raw data and JSON selected. | ||
+ | {{: | ||
+ | Now we need to post the data. Refer below for an example of a setting I’m using. | ||
+ | |||
+ | Examples could be “deck light”, “living room light”, “hallway light”, or even something cool like “netflix” if your OpenHAB is able to control your TV! | ||
+ | |||
+ | Note that if you’re running the Echo HA Bridge on a different PC than your OpenHAB, you’ll need to replace both spots where it says “localhost” with your OpenHAB IP address. | ||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | {{: | ||
+ | When you are finished making your changes, click “Send” on Postman. | ||
+ | {{: | ||
+ | |||
+ | When you’re finally done uploading devices, go to Chrome or your browser of choice and navigate to \\ | ||
+ | < | ||
+ | http://< | ||
+ | </ | ||
+ | You should see all of your loaded devices there.\\ | ||
+ | {{: | ||
+ | ==== STEP 3: LOAD SETTINGS INTO YOUR AMAZON ECHO ==== | ||
+ | |||
+ | On your phone, launch the Echo app. Open the Settings page and scroll all the way down where it says “Connected Home”. | ||
+ | |||
+ | ==== Comments ==== | ||
+ | |||
+ | One thing to add is on Linux at least you have to open port 1900 UDP for Alexa to pick up the device list. | ||
+ | |||
+ | Why aren’t you just using the built in configuration tool? | ||
+ | |||
+ | http:// | ||
+ | |||
+ | (Honest question – I’ve seen the POST approach elsewhere and don’t understand why all these tutorials neglect to mention the easier config method. Seems to work fine for me.) | ||
+ | |||
+ | It’s probably because the Echo HA Bridge isn’t documented very well :P. I didn’t even know about a Configuration page! On the GitHub readme, the instructions are to POST JSON to / | ||
+ | |||
+ | I’ll check it out. I’d love to update the article with a simpler process to make it more accessible. Thanks for the tip! | ||
+ | |||
+ | All I want to accomplish is the ability to control actions on my Harmony Hub like turn on TV, etc. I think I have the echo-ha-bridge running but I cant wrap my head around installing the OPENHAB and adding the Harmony, whats the easiest way to do this? I have the following items as well to choose form if needed: MAC OSX Server box, Physical HUE Hub, WINK Hub, Harmony Hub, Android Tablet. | ||
+ | |||
+ | Any direction is appreciated. I take direction well and I am pretty tech savvy. | ||
+ | |||
+ | This question is probably too broad to answer in a comment (especially because I don’t have a Harmony Hub), but I’ll do my best. | ||
+ | |||
+ | This is a somewhat ugly solution, but since I don’t have a Harmony Hub it’s the best I can come up with for now. I’ll be using a very simple example of two activities “Power Off” and “Watch TV”. These activities should already be defined on your Harmony Hub. I have no way of testing this so there may be an error or two. Come back if it doesn’t work and I’ll try to help. | ||
+ | |||
+ | Here’s a general overview of what you’ll need to do: | ||
+ | - Download the OpenHAB runtime with demo configuration and unzip it | ||
+ | - Download the OpenHAB Addons and place org.openhab.binding.harmonyhub-1.7.0.jar into your / | ||
+ | - Open openhab.cfg in the / | ||
+ | < | ||
+ | harmonyhub: | ||
+ | harmonyhub: | ||
+ | harmonyhub: | ||
+ | </ | ||
+ | - Open demo.items in / | ||
+ | |||
+ | < | ||
+ | Switch HarmonyTvSwitch | ||
+ | </ | ||
+ | |||
+ | Open demo.rules in / | ||
+ | < | ||
+ | rule "TV On" | ||
+ | when | ||
+ | Item HarmonyTvSwitch received command ON | ||
+ | then | ||
+ | harmonyStartActivity(" | ||
+ | end | ||
+ | |||
+ | rule "TV Off" | ||
+ | when | ||
+ | Item HarmonyTvSwitch received command OFF | ||
+ | then | ||
+ | harmonyStartActivity(" | ||
+ | end | ||
+ | </ | ||
+ | Now upload the configuration into your HA Bridge. Your onUrl property should be | ||
+ | < | ||
+ | http://< | ||
+ | </ | ||
+ | and offUrl property should be | ||
+ | < | ||
+ | http://< | ||
+ | </ | ||
+ | Here are some good resources: | ||
+ | OpenHAB Harmony Hub Binding wiki | ||
+ | Configuring the OpenHAB Runtime – Visit here when you want to learn more about OpenHAB. The learning curve is a little steep, but it’s by far the best home automation software I’ve ever used. Stick with it! | ||
+ | |||
+ | I downloaded the files you linked above but none of the specific files your want me to edit exist. (openhab.cfg, | ||
+ | |||
+ | SOrry! | ||
+ | |||
+ | Reply | ||
+ | |||
+ | I made a mistake. You’ll want to download the OpenHAB demo setup instead of the OpenHAB Runtime that I originally linked. That will include the demo setup files. I’ll edit my comment to correct it. | ||
+ | |||
+ | rich says:\\ | ||
+ | |||
+ | What am i missing here?\\ | ||
+ | First I fail to see how openhab connects to the bridge. Did I miss a step. It seems like alexa connects to the bridge running and can sent rest URLs directly to the zwave devices. i don’t see where opehhab comes into play(which is the part I’m probably missing) | ||
+ | |||
+ | The bridge runs on another port, and the URL is just the rest URL of the On/Off command for the zwave device. | ||
+ | When i ask alexa to turn off dining room light, it says it is not responding. | ||
+ | I have the bridge set up and listening, I have it in the echo app. | ||
+ | |||
+ | OpenHAB doesn’t really connect to the Bridge. The Bridge does an HTTP GET call to OpenHAB at the appropriate time. I see that I did a poor job of explaining that, and will go back and edit the article when I get a chance. | ||
+ | |||
+ | Is your OpenHAB at http:// | ||
+ | |||
+ | Can anyone confirm the server port command works? I have | ||
+ | < | ||
+ | java -jar amazon-echo-bridge-0.1.3.jar –upnp.config.address=192.168.1.200-server.port=8081 | ||
+ | </ | ||
+ | And the server continues to start with 8080.. did I miss something?? | ||
+ | |||
+ | Thanks ahead of time | ||
+ | |||
+ | I can confirm the server port command works. I tried it before I put it in the article. | ||
+ | |||
+ | Make sure the flag has 2 hyphens in front. –server.port=8081 | ||
+ | |||
+ | |||
+ | Learned a lot in this process and am answering my own questions for those who may have similar questions: | ||
+ | |||
+ | 1) The only real way to do it is to open the Echo App, go to Settings–> | ||
+ | |||
+ | 2) Definitely fully-qualified *localhost* URLs (not on port 8080), with codes in place of special characters.\\ | ||
+ | |||
+ | < | ||
+ | Example: “onUrl” : “http:// | ||
+ | </ | ||
+ | |||
+ | Aaron, this is really nice!! thanks for the write-up!! | ||
+ | I now have my first insteon light switch working now with the echo and openhab..\\ | ||
+ | |||
+ | I am not sure how to edit the device list. Is there an easy way to edit the api/ | ||
+ | or is it easier to clear the data folder and start over? | ||
+ | |||
+ | Now if I could just get my insteon sprinklers setup in openhab, I will be set to go!! | ||
+ | |||
+ | Thanks again. | ||
+ | |||
+ | Reply\\ | ||
+ | Aaron Tinsley says:\\ | ||
+ | |||
+ | Jay, | ||
+ | |||
+ | No problem! I’m glad it helped. As far as editing the device list for the Bridge, the honest answer is I don’t know. I did my initial setup and have mostly left it alone since then. I may pore over the source code and look for the answer. The only time I’ve spent in the source code thus far was to figure out how to change the listening port. | ||
+ | |||
+ | All of the commenters have made one thing clear… I’m way behind some of you in home automation! Good luck with your sprinkler system!\\ | ||
+ | |||
+ | Other people probably figured out how to have Alexa dim lights without needing it explained to them, but I thought I would comment and potentially save someone some time: | ||
+ | |||
+ | As of 0.1.3, the Echo-HA-Bridge supports dimming. In the Configurator page, use these URLs:\\ | ||
+ | < | ||
+ | On URL: http://: | ||
+ | Off URL: http://: | ||
+ | </ | ||
+ | I got it working tonight with 0.2.1 and OpenHAB 1.7.1, both running on Windows 10.\\ | ||
+ | **Controlling TV**\\ | ||
+ | I’m going bananas over this :) Probably to much fiddling around. I got Openhab to work with my LG TV. Wehn I try Armzilla to connect Echo it either gives me a blanc page while testing or XML error. In my items file in openhub I have:\\ | ||
+ | < | ||
+ | Group TV_Living “Tv Room” (LgTv) | ||
+ | Switch LgTvPower “Power Command” (GF_Living) {lgtv=”ON: | ||
+ | Switch LgTvMute “Mute” (GF_Living) {lgtv=”ON: | ||
+ | Number LgTvVolume “lgVolume [%.1f]” (GF_Living) {lgtv=”INIT: | ||
+ | Number LgTvChannel “Channel [%.1f]” (GF_Living) {lgtv=”INIT: | ||
+ | String LgTvChannelName “Channelname [%s]” (GF_Living) {lgtv=”INIT: | ||
+ | String LgTvGetChannels “getchannels [%s]” (GF_Living) {lgtv=”INIT: | ||
+ | String LgTvGetApps “getapps [%s]” (GF_Living) {lgtv=”INIT: | ||
+ | String LgTvAppExecute “excuteapp” (GF_Living) {lgtv=”*: | ||
+ | String LgTvAppTerminate “terminateapp” (GF_Living) {lgtv=”*: | ||
+ | Switch LgTvConnStatus “connstatus ” (GF_Living) {lgtv=”*: | ||
+ | </ | ||
+ | Can anyone please give me an example URL I should use to get this working? Openhab, Armzilla and Lovely Alexa so she will start Netflix :)\\ | ||
+ | |||
+ | I tried:\\ | ||
+ | < | ||
+ | { | ||
+ | “name” : “Netflix”, | ||
+ | “deviceType” : “switch”, | ||
+ | “onUrl” : “http:// | ||
+ | “offUrl” : “http:// | ||
+ | } | ||
+ | </ | ||
+ | But also: | ||
+ | < | ||
+ | http:// | ||
+ | </ | ||
+ | In my sitemap I have: (works great via webpage)\\ | ||
+ | < | ||
+ | Switch item=LgTvAppExecute label=”AppExecute” mappings=[Netflix=Netflix] | ||
+ | Switch item=LgTvAppTerminate label=”AppTerminate” mappings=[Netflix=Netflix] | ||
+ | </ | ||
+ | I must say, I have 0 coding experience :)\\ | ||
+ | |||
+ | Kind regards,\\ | ||
+ | Frank\\ | ||
+ | |||
+ | Aaron Tinsley says:\\ | ||
+ | |||
+ | Frank,\\ | ||
+ | |||
+ | Your URL should directly address the item, not the group it’s in. I haven’t tried controlling string items (just switch items), but you can try this.\\ | ||
+ | < | ||
+ | http:// | ||
+ | </ | ||
+ | [value] should be a URL-encoded string. To URL encode a string, go to this link, type your string in the “Plain” box, and then hit the button that says “URLEncode”. It will output the URL-encoded string in the “Encoded” box.\\ | ||
+ | |||
2016/ha/control_openhab_with_alexa.1462987437.txt.gz · Last modified: 2016/05/11 13:23 by 75.177.137.2