New Binding: Hue Emulator - Amazon Echo integration

There’s a new binding which exposes OH2 items as Hue Devices to 3rd party apps. It was originally intended to allow an Amazon Echo to directly control OH2, but it should work for other devices like the Logitech Harmony remotes. I would appreciate feedback. It uses the exact same tagging format as the new Homekit binding, instructions can be found at https://github.com/openhab/openhab2-addons/tree/master/addons/io/org.openhab.io.hueemulation .

2 Likes

Few more things I should mention, after installing you will need to go into the paper ui under configuration-> services-> Hue Emulation and turn pairing on, this will allow the binding to accept new pairing requests. Once you devices are paired you can go back and disable this for security purposes. When pairing is enabled ask you echo “discover services” and see what happens, it will use the label on the item as the voice name. Both OH2 and the echo should be on the same subnet as it uses UPNP to find each other.

Dan - Got the binding installed and pairing enabled. I followed the instructions for adding the tag to the items file. I noticed the following error:

09:04:19.538 [ERROR] [tion.internal.HueEmulationUpnpServer] - Socket error with UPNP server
java.net.BindException: Address already in use
at java.net.PlainDatagramSocketImpl.bind0(Native Method)[:1.8.0_72]
at java.net.AbstractPlainDatagramSocketImpl.bind(AbstractPlainDatagramSocketImpl.java:93)[:1.8.0_72]
at java.net.DatagramSocket.bind(DatagramSocket.java:392)[:1.8.0_72]
at java.net.DatagramSocket.(DatagramSocket.java:242)[:1.8.0_72]
at java.net.DatagramSocket.(DatagramSocket.java:299)[:1.8.0_72]
at java.net.DatagramSocket.(DatagramSocket.java:271)[:1.8.0_72]
at org.openhab.io.hueemulation.internal.HueEmulationUpnpServer.run(HueEmulationUpnpServer.java:76)[166:org.openhab.io.hueemulation:2.0.0.201602250203]

Turns out this was caused by a conflict with my Plex server, and it went away when I shut it down. I’m not seeing any errors in the standard log at this point but Alexa isn’t picking up any devices.

Can you point me in the right direction for troubleshooting this? I’ve solely been using openHAB1 and this is my first foray into openHAB2, so I’m a little lost!

first off can you run it in debug mode? Start OH2 with the debug mode script (start_debug.sh/bat), when the OSGI console comes up type log:set DEBUG org.openhab.io.hueemulation. Also is the Alexa and your OH instance on the same network? Do you have items tagged with something like homekit:Lightbulb? Do you know if your OH instance has more than one IP or network interface?

Sorry I meant is your Echo and OH2 on the same subnet.

Thanks for the help. I started logging with DEBUG, but I wasn’t seeing anything that looked pertinent (other than the hue emulator starting). I switched it over to trace and see this as I try to pair:

10:35:43.165 [TRACE] [tion.internal.HueEmulationUpnpServer] - Got SSDP Discovery packet from 192.168.1.200:36317
10:35:43.165 [TRACE] [tion.internal.HueEmulationUpnpServer] - Sending to 192.168.1.200 : HTTP/1.1 200 OK
CACHE-CONTROL: max-age=100
EXT:
LOCATION: http://127.0.1.1:8080/api/discovery.xml
SERVER: FreeRTOS/7.4.2 UPnP/1.0 IpBridge/1.10.0
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:4a760074-8cc0-4d2b-9174-a17e4b40cc00::urn:Belkin:device:**

0:34:58.599 [TRACE] [tion.internal.HueEmulationUpnpServer] - Got SSDP Discovery packet from 192.168.1.125:50000
10:34:58.603 [TRACE] [tion.internal.HueEmulationUpnpServer] - Sending to 192.168.1.125 : HTTP/1.1 200 OK
CACHE-CONTROL: max-age=100
EXT:
LOCATION: http://127.0.1.1:8080/api/discovery.xml
SERVER: FreeRTOS/7.4.2 UPnP/1.0 IpBridge/1.10.0
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:4a760074-8cc0-4d2b-9174-a17e4b40cc00::urn:Belkin:device:**

192.168.1.125 is the echo, 192.168.1.200 is the server, and I’m also seeing it from 192.168.1.208 which is my Hue bridge. Same network, same subnet, only one network interface, tagging like this - [“homekit:Switch”]

yikes, it’s returning your loop back address in the SSDP! I was actually wondering if this could happen, I guess it could! Give me a minute and I’ll get you an updated version.

can you try https://github.com/digitaldan/openhab2-addons/releases/download/HueEmulator-1/org.openhab.io.hueemulation-2.0.0-SNAPSHOT.jar ? Make sure the old one is removed first.

Removed the old one from the paper UI, added the jar to my addons folder. Pops back up in the paper ui, set it for pairing and restart the server for good measure. Still getting the same read outs and nothing is being picked up by the echo.

Thanks for all the time you are putting in on this!

Shoot, yes I see why, I rushed it and missed a spot. Hold please…

Try this one again:
https://github.com/digitaldan/openhab2-addons/releases/download/HueEmulator-1/org.openhab.io.hueemulation-2.0.0-SNAPSHOT.jar

It seemed like it kept reinstalling it after I would remove it, got fed up and reinstalled the whole thing. Downloaded the latest jar, put in the addon folder, enabled pairing. Getting the same readout with the TRACE logging.

19:09:57.775 [TRACE] [tion.internal.HueEmulationUpnpServer] - Sending to 192.168.1.125 : HTTP/1.1 200 OK
CACHE-CONTROL: max-age=100
EXT:
LOCATION: http://127.0.1.1:8080/api/discovery.xml
SERVER: FreeRTOS/7.4.2 UPnP/1.0 IpBridge/1.10.0
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:cedfa602-28a9-486b-a675-d75f0f6f95dd::urn:Belkin:device:**


19:09:57.879 [TRACE] [tion.internal.HueEmulationUpnpServer] - Got SSDP Discovery packet from 192.168.1.125:50000
19:09:57.880 [TRACE] [tion.internal.HueEmulationUpnpServer] - Sending to 192.168.1.125 : HTTP/1.1 200 OK
CACHE-CONTROL: max-age=100
EXT:
LOCATION: http://127.0.1.1:8080/api/discovery.xml
SERVER: FreeRTOS/7.4.2 UPnP/1.0 IpBridge/1.10.0
ST: urn:schemas-upnp-org:device:basic:1
USN: uuid:cedfa602-28a9-486b-a675-d75f0f6f95dd::urn:Belkin:device:**
1 Like

Try this again https://github.com/digitaldan/openhab2-addons/releases/download/HueEmulator-1/org.openhab.io.hueemulation-2.0.0-SNAPSHOT.jar

Also you should be able to just copy over the last one and not restart, ESH should uninstall the old one and start this one.

1 Like

Success! Huzzah!

Everything seems to work great, thanks!

@digitaldan am waiting for a PR then :slight_smile:

:slightly_smiling:
https://github.com/openhab/openhab2-addons/pull/681

@Kai @digitaldan As there is not an interface yet for managing tags, I went to the REST API, but am having some trouble. It seems I cannot PUT a tag with a colon in it. Even the example created in the REST docs gets a 404. If I remove the colon the PUT works fine and the tag is created. Can you verify? This is OH2 of course.

Could you please create an issue at https://github.com/eclipse/smarthome/issues? Thanks!

Done. https://github.com/eclipse/smarthome/issues/1122

I can’t seem to get this to work. I’ve added the Hue Emulator to my addon folder and then went into Paper UI and enabled pairing. Then in my my items file I add [“homekit:Switch”] to the light that I want to control but it gives a “missing EOF at ‘[’” error in ESH. Am I missing something?