openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.88k stars 3.59k forks source link

[hueemulation] Change by Amazon/Alexa renders the binding Dead #6121

Closed KidSquid1 closed 3 years ago

KidSquid1 commented 5 years ago

Have been running the HUE Emulation binding for over 2 years without any issue. Sometime early last week or the week prior a change was made by Amazon which prohibits the binding from communicating with Alexa's servers.....all devices show "Server is Unresponsive"in the Alexa app or via the Alexa web portal.

I have tried to remove the devices and have Alexa rediscover with no luck.

I am running OH 2,4 with a 2.3 version of the Hue Emulation binding - I know they are older but have been stable for quite a long time in my environment.

There are others posting on the forums that are having the same issue as well: https://community.openhab.org/t/hue-emulation-stopped-working-all-devices-are-of-type-various-now/81566/47

This new twist removes all of my Alexa enabled commands which my household uses quite frequently. Would be happy to help test or provide feedback in any way I am technically able to.

@digitaldan

Squid

KidSquid1 commented 5 years ago

BUMP....Any thoughts on this?

ngrodum commented 4 years ago

I got it to work. I had been struggling quite a bit with this on 2.4 lately so I though I'd put in some effort. I updated to 2.5M3, but things just got worse. Instead of going back to 2.4, I went into the codebase and did some debugging. Found out I had to do some code changes to the hue emulation addon. First thing I had to do was fix some problems with ipv6 vs ipv4. Second thing was the fact that the Jetty server would just return 415 whenever my Echo devices would send the "Content-Type" header in a GET request. When I filtered out that header on GET requests Jetty stopped complaining and the discovered devices started working! No more "Server is unresponsive"! I made a PR that fixed the "server is unresponsive" for me. (I also had weird discovery issues) https://github.com/openhab/openhab2-addons/pull/6402

KidSquid1 commented 4 years ago

@ngrodum Could you post a copy of your new .jar file so that I could test? Would really like to get this working.

Thanks,

Squid 🦑

ngrodum commented 4 years ago

org.openhab.io.hueemulation-2.5.0-SNAPSHOT.jar.zip

ngrodum commented 4 years ago

This was the build I'm running myself now. It is based on master plus my fixes for ipv6 and and the 415/nothing works fix. I just remembered it has another change - group items with hue tags will be exposed as devices. https://community.openhab.org/t/hueemulation-group-items-can-no-longer-be-exposed-as-hue-devices

KidSquid1 commented 4 years ago

Thank you for the file....

Unfortunately I'm still running 2.3 and your jar is asking for a dependency org.openhab.core.automation - looks like I'm going to need to bite the bullet and bring my system a bit more current to try this....

Your work is much appreciated.

Squid

pfink commented 4 years ago

Tested it with 2.5.0.M5 today. Unfortunately, it does not work. I tested options "Add unknown user keys" and "emulate V1 bridge" seperately. With both options, no success. Any advice @ngrodum?

thedannymullen commented 4 years ago

I tested on 2.5m5 also but no luck. I support the only question is did I install the jar file correctly.

I uninstalled the old hue emulation, dropped the jar file in the addons folder and restarted?

ngrodum commented 4 years ago

I would log on to https://alexa.amazon.com/spa/index.html#appliances and forget all devices.

I went into advanced Hue-emulation config and set the timeout for pairing to some minutes.

Then I'd wait some minutes, unplug all Echos except the oldest one I have (I think it's a gen2 Echo dot). I would then turn on pairing mode, (don't remember about the V1 or no, have been back and forth myself - however, "Add unknown user keys" was probably enabled.)

Just as I save that, I tell the Echo: "Alexa, scan for devices".

If you need to verify the binding, I use the karaf console and issue something like: bundle:list|grep -i hue

thedannymullen commented 4 years ago

I installed the jar file above into my addons folder on 2.5m5. Then I went to the console and said:

openhab> bundle:start org.openhab.io.hueemulation I get this error: Error executing command: Error executing command on bundles: Error starting bundle 216: Could not resolve module: org.openhab.io.hueemulation [216] Unresolved requirement: Import-Package: io.swagger.annotations; version="[1.5.0,2.0.0)"; resolution:="optional" Unresolved requirement: Import-Package: org.openhab.core.automation

thedannymullen commented 4 years ago

Ok dependencies resolved once I installed the 'hue' binding. It is now running.

Good news and I need to have some further testing, but on my one test item it looks like this jar file will work with Alexa. I used the web page alexa.amazon.com to discover my test item.

pfink commented 4 years ago

@ngrodum: Did you test that device communication really works?

What I found out during my tests is that the "forget all devices" feature by alexa.amazon.com does not work. First, I was wondering why devices are discovered that I don't have anymore. Then I completely turned off openHAB and surprise surprise: When I use the "forget all devices" functionality, all deleted devices appear again in the list after the next discovery, even if there should be nothing. For me, I had to use "forget" for each single device, this worked.

As your tests seemed to end with the discovery, maybe you just experienced the same bug and thought its working now because of that?

After I got my devices deleted correctly, they were not discovered again. At no point of time during my tests, I could successfully control an openHAB device with Alexa.

pfink commented 4 years ago

Ok dependencies resolved once I installed the 'hue' binding. It is now running.

It has nothing to do with the Hue binding. Probably your issue would have been resolved by openHAB restart or cache deletion as well.

thedannymullen commented 4 years ago

Here is my updated status as of today. I tried the binding again on my production system after doing a full update to 2.5m5. The binding prepared by @ngrodum does function, but it tells me I am not quite sure what went wrong after doing the command. I am also having some discovery problems, I had to discover multiple times. Still not sure all my items are in. Many show up as just "switch" or "color temperature" vs the name of the item.

Here was my process: Put the binding in the addons folder. Resolv dependency by installing the next generation rules engine. This forces org.openhab.core.automation to be installed. I then cleared cache and restarted openhab.

ngrodum commented 4 years ago

@thedannymullen if they show up as "switch" or "color temperature" as names, I would verify there are no special characters in any items you have defined. Also, you should look at your lights output (e.g. http://openhab/api/31337bad-dead-4632-8bad-b85af023badf/lights - you can get your url/user id by visiting http://< openhab server>/api/status - look for anything that breaks the JSON, or see if any items actually have received the name "switch" from openhab.

When I think, I belive I have seen an item called "brightness" once in a while in my setup.

This is for sure a separate bug - anyone know if this is tracked?

thedannymullen commented 4 years ago

Don’t know if it is tracked. I did not see it in the hue emulation list.

Thanks for tips I will research.

pfink commented 4 years ago

I could at least partly get it work on 2.5.1 now:

  1. Delete every single item from https://alexa.amazon.de/spa/index.html#appliances (don't use "delete all" functionlity, it does not work, devices appear again after next discovery even if there is no bridge at all)
  2. Ensure openHAB runs on port 80 (as described here: https://www.openhab.org/addons/integrations/hueemulation/#troubleshooting)
  3. Enable "Pairing", "Unknown User Keys" and "Temporarily emulate v1 bridge".
  4. Search for Smart Home devices

Discovery and usage works now. Anyhow, always when I turn on my lamp, Alexa says "[Device] does not seem to work" even though it worked. When turning off the lamp no such thing happens.

cherub-i commented 4 years ago

@pfink

Anyhow, always when I turn on my lamp, Alexa says "[Device] does not seem to work" even though it worked. When turning off the lamp no such thing happens.

Yup, that's covered in https://github.com/openhab/openhab-addons/issues/6690

pfink commented 4 years ago

Ah, ok! So should we close this issue?

hmerk commented 3 years ago

closed due to inactivity