New Binding: Amazon Echo

HI all, I finally got around to creating a binding to link OH2 to my Amazon echos. I just got this working like 10 mins ago, so to say it’s rough is an understatement!

This Binding emulates a Hue Bridge, allowing the echo to directly control it. This has two big benefits over using a alexa hosted app. One is that it is super fast, control is done over the local network and not from the cloud. Two is that there is no wake word, you just say “Turn lights ON” or “Set Thermostat to 70”.

This should also allow other Hue compatible devices (like the Logitech Harmony) to see openhab, I plan to make those work as well, but one step at a time.

Your can find the jar at:
https://github.com/digitaldan/openhab2-addons/releases/download/HueEmulator-1/org.openhab.binding.hueemulator-2.0.0-SNAPSHOT.jar

and the source code at:
https://github.com/digitaldan/openhab2-addons/tree/HueEmulator/addons/binding/org.openhab.binding.hueemulator

To use the binding drop the jar in your addons folder. Items are exposed to the echo using tags, the format is “he:Voice Name” so for example
Switch TestSwitch [ "he:Kicthen Lights" ] Number TestNumber [ "he:Thermostat" ]

After adding tags, say “Alexa search for connected devices” and see what happens.

Right now this supports ON/OFF and Decimal/Percent commands. Couple known issues, first is that sometimes I have to search more than once to find devices. Also I have no idea what happens if you are using the Hue binding (your feedback is appreciated), I would imagine I need to filter local requests or something. Also there is no security here, I plan to add a include button/channel to mimic how the actual Hue bridge does this. Finally, I need to clean up the code, but I wanted to get feedback asap, so I’m exposing the dirty laundry so to speak.

9 Likes

Wow Dan, this is great news.
I will give this a try and will report my experiences.

Best
Hans-Jörg

This sounds AWESOME Dan - well done!! This might have just tipped me over the edge in terms of buying one of these…

Wow, sounds great, Dan!
I am looking forward to try it out soon!
Would also be great if you could create a PR, so we can discuss details directly on Github then.
At a very first glance, it e.g. does not really fit into the “binding” category - I think it is something “new” instead that we should define :slightly_smiling:

Cheers,
Kai

Sounds pretty cool Dan!
Do you not even need to say “Alexa” at the beginning and then the command?

Sorry, yes you need to say the wake word, so Alex or Amazon , but you do not have to say an app word. So “Alexa, turn lights on”. If I had tried to use the Alexa api you would also have to say an app name, which I found awkward, like “Alex, tell openhab to turn lights on”

Thanks Kai, I will do that tonight. One thing that pained me was having to use a servlet vs the built in jaxrs support. I posted this over on the eclipse forum, my jaxrs version was way cleaner, but we can discuss on github.

Very cool!

Any chance this might be backported to support OpenHAB v1.x?
Also, do you know of any way to customize Alexa’s reply? I would like to have her reply with something more than ‘OK’ with each command… AFAIK this is only possible via a Skill.

Thanks,
.

Whilst I can’t speak for other Dan, the structure of OH1 and OH2 bindings differ quite a bit and if it were me I wouldn’t bother going through the effort trying to backport when OH1 will be replaced by OH2 completely in the (not too distant) future.

“Ok” is the only response to a command , using the Alexa skills api would be the only way to do customs responses afaik.

Yes this is might thought as well

@digitaldan
That’s awesome! This will probably make me bite the bullet and install OH2.x to give it a try…

My main use case right now would be to open the front gate so being able to do an “open” command to do that would be super cool!

As I understood, adding custom commands like “open” can only be added by skills or by Amazon.
Right now, Alexa does not understand open as a command for connected devices.

It’s too bad, I would put one in every room of my house if I could control my house without “tell openhab”

1 Like

Most of the things I own can be controlled with on, off or a level. So I can say “alexa set Heat to 75”, “Alexa, increase Kitchen Volume” “Alexa, turn Kitchen Music on” and so on. For open and close, I would use On and OFF, so “Alexa, turn garage door on”. It’s not perfect, but covers a whole lot. You just have to be a little creative :wink:

How many devices have you tested this with? Does it have the same 26 device limit that the amazon-echo-ha-bridge has?

@sipvoip, I just added 30 devices and they were all picked up by the echo.

For 1.* (tested/working in 1.7.1 and 1.8.1) the echo-ha-bridge java app works perfectly well too. This plugin will be handy for direct integration but for now I’ll stick with and recommend echo-ha-bridge. Good job getting it closer to ‘native’.

Kai,

Doesn’t it resemble the io.myopenhab addon?

Yes, absolutely, see my proposal for org.openhab.io.hueemulation here.