New Binding: Hue Emulator - Amazon Echo integration

So, I’m probably missing something really obvious here, as I’m pretty new to openhab, but I’m struggling with getting this to work with my harmony hub.

I’m right in thinking I can map it to switch on / off a specific harmony hub activity right?

I’ve tried something like this in my items file;

String Master_Bedroom_Harmony_Activity "Harmony Current Activity [%s]" [ "Switchable" ] { channel="harmonyhub:hub:Bedroom:currentActivity" }

and I have this in my sitemap;

Switch item=Master_Bedroom_Harmony_Activity mappings=[PowerOff="Off", "Watch Fire TV"="On"]

But it doesn’t get detected by the echo - it can confirm the binding is working though as I can set my thermostat temperature ok via it.

I was hoping it would map the ON/OFF commands from the sitemap back via the binding, but I’m guessing not… any ideas how I can get that working?

(It does work perfectly via the OH web interface by the way).

I cant get this hue emulator to be discovered by my echo. First i am a total noob to openhab but i have a solid understanding of networking and what nots. i used amazon-echo-ha-bridge and it worked. I am on openhab2b4 and have things running in trace. My system does have a bunch if IPs and I set the org.openhab.hueemulation:discoveryIp to the correct IP and enabled pairing. I can go to the api/discovery.xml4 url and get a bunch of devices listed. SO I think my test items and binding hopefully are right. The problem is my echo doesnt see any new devices. Everything is on the same network and subnet. The only SSDP Discovery packet i see in the logs are from a docker subnet i have. Nothing from my home network. tcpdump shows lots of ssdp traffic. I am not sure what to do! I would love to have this work natively in openhab. I hope this is the right forum!

You’re not alone, I think it’s related to the updates to Echo to add scene support.

I suspect it would be better to go the route of the Smart Home Skills Kit. The one issue then is that it generally has to be on an external network. Perhaps OH could integrate it with myopenhab

SO! I installed this in a virtual box and woola no issues. I suspect my network config is what is causing the discovery issues (maybe my network bridge)?? Anyway i would be more than happy if anyone wants to debug this with me. for now Ill stick to my vm as it seems to be doing the job. BTW this is a great piece of software. Thanks so much!!!

I suspected it was some conflicting service, but the logs don’t seem to imply where the conflict is. I assumed it Just wanted a traditional port 80 http connection, so I made a reverse proxy for /api, but that was insufficient. Any chance you can figure out what ports it uses?

Hello, I had originally posted in this older thread regarding the Hue Emulator, but this thread one seems to be slightly more active, so I thought I should post here too, just in case.

Has anyone been able to test the Hue Emulator in OH2 with more than 32 devices? I am seeing that if I have 32 devices tagged with [“Lighting”] and [“Switchable”], everything works fine with Alexa, but if I add a 33rd device, Alexa is no longer able to discover my devices and everything appears “Offline”.

I am using insteon switches specifically, but anyone should be able to easily test this with virtual switches. Just add a bunch like this:

Switch test_1 "Test 1" ["Switchable"]
Dimmer test_2 "Test 2" ["Lighting"]

Please see my two posts in that thread (1, 2) for more information about the issue.

I’ve recently added a few echo dots to my system and now it seems like the echo is having a problem talking to openhab. All the dots are in different rooms and only one hears me at a time. I am able to ask Alex in one room to turn on and off a light then I move to another room and ask her to turn on and off the same light and she says that the smart home device is not responding then a few seconds later the light turns on or off. Just very strange behavior and I’m not sure what’s going on. From the logs I see no errors and I’ve removed all devices and added them back and also tried rebooting everything.

I am trying to get the binding configured on my linux container. I have two interfaces and I have set the preferred ip address for the binding to use under Paper UI -> Configuration -> Services -> IO -> Hue Emulation. However, with the correct ip entered, it is still binding to the ip address of the other interface. Has anyone else had this issue? How can I get the binding to use the correct network interface.

So I was finally able to get the binding to work with my setup that has multiple ip addresses. The issue was that I was on Openhab2 Beta 4 and not the latest snapshot which included the ability to specify the ip address to bind to.

Is there any reasonable speed-difference between the hue bridge of the 1st and 2nd gen? I use the 1st gen and sometimes it´s impossible for alexa to call the bridge.

I have a 2nd generation Hue bridge and I almost gave up on it because of reliability. I don’t have experience with the 1st gen bridge, but I was able to vastly improve Hue reliability in my house by doing 3 things:

  • Move the bridge away from my wifi router
  • My bridge was fairly close to my Airport Extreme. There may have been interference since they both run on 2.4gHz. I just moved it about 5 feet away.
  • Change the channel on the Hue bridge
  • I changed from the default channel (11 I think?) to 20 in the settings of the Hue app. I’m not sure if the bridge does any sort of automatic channel selection.
  • Make sure there are no obstructions near the bridge
  • For a long while, I actually had the bridge sitting on top of an old macbook which was made out of aluminum. The hue lights downstairs only worked about 50% of the time. Removing that obstruction made an immediate difference in the communication. You might have similar problems if it’s sitting on top of metal audio components or shelving.

I’ll admit that I’m not sure exactly which of those changes were responsible for the improvement, and to what degree, but after making these changes, OH2 has been able to control my hue lights without any issue. As far as I know, not a single command has been missed since then.

Has anyone had a chance to investigate the issue with >32 devices?

I would be interested if anyone else can reproduce this. Anyone who has the Hue emulator installed and an Echo or Echo Dot, I made a simple list of 32 devices that should identify to Alexa. You can just create a new items file with these contents: http://pastebin.com/Aw0sJeRp

Again, 32 devices works fine for me, but 33 makes Alexa report everything offline. There is a 33rd device in that file that is commented out, just remove the /* */ comments to test it.

@anthonygillet Thanks for your improvement tips. - The location is fine already but changed the channel another time, maybe it will help :slight_smile:

But I´ve some strange phenomena with TargetTemperature- It sets random values or states for the temperature, instead of the ones I said to Alexa. - Tried with homematic thermostat (HM-CC-RT-DN)

I´d like to help you on your ’ too-much-devices-problem’ and added your item-list to my config aaaaaand… it seems to work fine, with overall 57 devices of mixed type - tested with OH2 build #564, echo dot and the german alexa app.

Hope this helps you a bit.

Thanks, any more information is helpful! Although that’s not exactly encouraging :slight_smile:

However, I have OH2 build 477. Perhaps there have been changes to the hue binding since then? That appears to be the latest one I can get for RasPi through apt. I guess maybe I can change to point to a less stable repository. I’ll try to look up the change logs on github and see if there was any activity in the hue binding.

I just set up openHAB today to control my Homematic system with Alexa. The lights are working fine, but the temperature control gives me problems. It’s not random as for Simson, but instead of the desired temperature it is always set 1°C too low. I think I know what the problem is: debugging shows me that the Hue Emulator receives the setpoint as percentage converted to 8 bit value, whereas 0°C = 0% = 0 and 100°C = 100% = 255. The value itself is truncated, so that for example 21°C = 21% of 255 = 53.55 is received as just 53 (and not 54 if you would round the value). This is then translated back to percentage, which gives us 20.78%, which is then again truncated to just 20% (and not rounded to 21%). And as percentage equals temperature, the thermostat is then set to 20°C instead of the requested 21°C. The first truncation is done on the Amazon servers, so we can’t do anything about that, but the second one is done from the Hue Emulator. If the value would be rounded instead of truncated, it would still set the right temperature (I did not yet calculate for every single setpoint, but I think most of the time the temperature would be right).

How do you guys actually name your devices when you propagate them to the Echo system? I’m asking because I have a whooping 4 devices right now and have massive problems getting Alexa to recognize the one I want to manipulate!

If I name stuff like this::

Arbeitszimmer Licht
Arbeitszimmer Heizung
Badezimmer Licht
Badezimmer Heizung

Alexa always asks which device I really meant. I’ve also tried several deviations of this but haven’t had no luck so far.

By the way: My system mirrors what @Yanai describes. I tell Alexa to set the temperature to 22° and the command is executed with 21°. So far, it seems as if the value is always -1 of what I expected.

I am using a current snapshot and am currently using a rule to workaround this.

I have named them the other way, i.e. “Licht Bad“, “Licht Wohnzimmer“, “Licht Küche“and so on, and Alexa has no problems switching the right light. I can even say “Schalte das Licht im Bad ein“ and it works.

As regards this problem with OH2:

I was finally able to solve this issue. I installed openhab on a second Raspberry Pi system because I thought I was going to have to just run multiple instances to cover all my devices. However, on the new installation, I could not reproduce this bug. I was able to get Alexa to see 90+ devices with no problem.

I tried a bunch of other things to repair the first installation, but in the end it was the nuclear approach that worked. From the osgi console, I typed:

smarthome:items clear
smarthome:links clear

I also deleted the contents of the following directories:

/var/lib/openhab2/cache
/var/lib/openhab2/hueemulation
/var/lib/openhab2/mapdb

Note: be careful with these directories! This will delete all of your extensions, your hue emulator pairing data, and your mapdb database! Of course, you can just reinstall your extensions through Paper UI or they will be automatically reinstalled if you have them defined in addons.cfg, but your item state DB will be lost.

I can’t even really recommend this approach since I’m not sure exactly which part solved my problem, but if anyone else has a similar issue at some point, these are just some things you can try.

Oh, one other thing I should mention, I also updated to an OH2 nightly build from beta4. I’m running build 576. I tried updating first though, and that did not solve the problem - only the steps above did, but it’s worth mentioning since perhaps updating does factor in to this process somehow.

(I posted this in the other thread as well, just in case it helps someone)

Yeah, that’s what I’ve got working right now too. Works so much better.

There are still some words I have to avoid. Alexa seems to have trouble with some first names.

I’ve been able to pair the echo but when I tell Alexa to turn off (Milight) lights she says “Ok” but they don’t turn off. Why is she lying to me? I’m using paper ui for everything and I can turn off lights in the classic ui.