New Binding: Hue Emulator - Amazon Echo integration

@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.

Check your log wether OpenHab receives the command from Alexa.

All of a sudden hue emulation stopped working for me (was working fine past 2 month). I tried to reset OH2,
"
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

"
Reset echo dot but nothing helped. Log says - Started Hue Emulation service at /api.

Any ideas ?

Hi!

@r27
I had the same problem. Have your devices you are controlling changed id? If so might be the same problem I had.
For me, I did a reinstallation of openhab2, since i switched hardware and got a new id for my Z-wave controller. I had to remove the devices from my amazon account and do a rescan (Don’t forget to activate paring).

Regards, S

Nothing changed. I have only 1 z-wave device. Do you mean to use alexa app to remove/discover devices ? I did that.

@r27
Yes. Does Alexa find the device when you rescan?

It doesn’t. That is the problem. And I did reset alexa. The last step I have to do is setup new OH2 and try it.

Thank you!

I am noticing the same phenomena with my system. If I ask to set the temperature to 70, the item is updated with 69. Any plans to address?

Hi. I finally got my Echo(s) yesterday :grin: so i wanted to get this voice-controll-super-cool-feature up and running. I am already following this issues for some months now to find a solutions to get Alexa working with my KNX stuff. I think by far the easiest (to start this journey) seems to be this HUE Emulation service!
So, my OH2 is already operational (incl. Sonos and KNX bindings).
But now i am completely lost … Alexa does not find any device (the tagging in .items is done).
I tried all the recommendations in this post. So my last chance is to ask the community.

Did i miss something? Do i have to configure the HUE binding in OH2 on-top of the emulation service? Do i have to add the HUE skill to my Echo? Placing the .jar file of this project into the addons folder is enough?
Can´t believe it´s really as easy as tagging items, enable pairing and that´s it comared to the other super-mega complicated solution out there :confused:

Any help and comments highly appreciated.

John,

In OH2, you should be able to get Alexa via the Hue Bridge functional with a couple of simple steps.

  1. Install the Binding via Paper UI, I’ll assume you’ve done this. OR Add the Binding to …/services/addon.cfg

  2. Add an appropriate tag to your Items. ie - [“Switchable”]. Personally, I add this Item as a second Channel in Habmin to associate it to the Z-Wave device I want to switch.

Switch LtToyRoom  "Toy Room Lights" (gLights)    ["Switchable"]
  1. Enable Device Pairing in the Paper UI. Configuration --> Services --> IO --> Hue Emulation Configure. OR put it in a Services File.
  2. Tell Alexa to Find your Devices.
  3. Turn on logging if you aren’t finding a problem.
log:set DEBUG org.openhab.io.hueemulation
  1. Tell Alexa to Turn On or Off what ever your Label name is. For the Item above, you would say, “Alexa turn ON the Toy Room Lights.”

If this is still not working, then turn on logging and share your Item definition, and log detail.

Tony

1 Like

Hi Tony,

thanks for your response.
Well, i think the problem is the installation part …
What Binding due you mean exactly? I can’t find a Hue Bridge binding in Paper UI. Only the "Hue Binding"
The only thing i did was to add the .jar file for the “openHab Hue Emulation Service” from Github to the addon directory (/usr/share/openhabe2/addons).

The rest shoud be OK.
the items are tagged with “Switchable” or “Lighting”, pairing is enabled via Paper UI. Configuration --> Services --> IO --> Hue Emulation Configure

But she still can’t find any devices.

Debug log when discovering devices (10.1.3.32 is the Echo).

16:31:26.377 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/discovery.xml
16:31:26.377 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/discovery.xml
16:31:26.377 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/discovery.xml
16:31:26.386 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/discovery.xml
16:31:26.696 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/fsI27NbdqOhF6xVv13sVQSXcLxDKwdoiTVvsjnPk/lights
16:31:26.701 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/fsI27NbdqOhF6xVv13sVQSXcLxDKwdoiTVvsjnPk/lights
16:31:26.701 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/fsI27NbdqOhF6xVv13sVQSXcLxDKwdoiTVvsjnPk/lights
16:31:26.701 [DEBUG] [ulation.internal.HueEmulationServlet] - 10.1.3.32: GET /api/fsI27NbdqOhF6xVv13sVQSXcLxDKwdoiTVvsjnPk/lights

At this point with HE in OH2 (somewhere around Beta 4), I would only Add the binding via PaperUI. Not long ago we needed to do a lot more hacking to add testing jars, but HE is pretty stable and PaperUI will grab the right jar.

I suggest…

  1. Remove the .jar file from addons.
  2. Restart or Reboot.
  3. Then add the Binding through Paper UI via the Add-ons --> Misc. --> Hue Emulation Install button.
  4. Then make sure you have Discover enabled.
  5. Maybe restart again and make sure you see a “Started Hue Emulation service at /api” message in your log at startup.
  6. Retest.