Openhab-addons: [HUE EMULATION] Alexa - Item is not responding

Created on 19 Nov 2017  路  14Comments  路  Source: openhab/openhab-addons

Since moving to 2.2 Build 1072 I have been experiencing issues with the HUE Emulation Service and Alexa. Items that have been rock solid now respond with "Ceiling Fan isn't responding" this seems to be somewhat intermittent as trying the same request an hour later might work. I just updated to the the latest snapshot build of 1084 and am still experiencing the same issues, yet I have not yet had Alexa respond to a single command. The following is what I see in the openhab.log file when I make a verbal request to Alexa.

There has been some discussion of this in the community forums at:

https://community.openhab.org/t/hue-emulation-alexa-not-responding-after-2-2-upgrade/35844

2017-11-19 10:22:12.280 [WARN ] [eclipse.jetty.servlet.ServletHandler] - /api/IpcI4oOGWNiM5yrMmomJswLE3ctYhogoZRxPBnrs/lights/Ceiling_Fan/state
java.lang.NumberFormatException: For input string: "Ceiling_Fan"
    at java.lang.NumberFormatException.forInputString(Unknown Source) ~[?:?]
    at java.lang.Integer.parseInt(Unknown Source) [?:?]
    at java.lang.Integer.<init>(Unknown Source) [?:?]
    at org.openhab.io.hueemulation.internal.HueEmulationServlet.apiState(HueEmulationServlet.java:323) [235:org.openhab.io.hueemulation:2.2.0.201711182329]
    at org.openhab.io.hueemulation.internal.HueEmulationServlet.service(HueEmulationServlet.java:281) [235:org.openhab.io.hueemulation:2.2.0.201711182329]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [35:javax.servlet-api:3.1.0]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [92:org.eclipse.jetty.servlet:9.3.22.v20171030]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [92:org.eclipse.jetty.servlet:9.3.22.v20171030]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [195:org.ops4j.pax.web.pax-web-jetty:6.0.7]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [89:org.eclipse.jetty.security:9.3.22.v20171030]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [195:org.ops4j.pax.web.pax-web-jetty:6.0.7]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [92:org.eclipse.jetty.servlet:9.3.22.v20171030]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [195:org.ops4j.pax.web.pax-web-jetty:6.0.7]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.Server.handle(Server.java:534) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [83:org.eclipse.jetty.io:9.3.22.v20171030]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [83:org.eclipse.jetty.io:9.3.22.v20171030]
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [83:org.eclipse.jetty.io:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at java.lang.Thread.run(Unknown Source) [?:?]
2017-11-19 10:22:12.281 [WARN ] [org.eclipse.jetty.server.HttpChannel] - //10.5.1.50:8080/api/IpcI4oOGWNiM5yrMmomJswLE3ctYhogoZRxPBnrs/lights/Ceiling_Fan/state
java.lang.NumberFormatException: For input string: "Ceiling_Fan"
    at java.lang.NumberFormatException.forInputString(Unknown Source) ~[?:?]
    at java.lang.Integer.parseInt(Unknown Source) [?:?]
    at java.lang.Integer.<init>(Unknown Source) [?:?]
    at org.openhab.io.hueemulation.internal.HueEmulationServlet.apiState(HueEmulationServlet.java:323) [235:org.openhab.io.hueemulation:2.2.0.201711182329]
    at org.openhab.io.hueemulation.internal.HueEmulationServlet.service(HueEmulationServlet.java:281) [235:org.openhab.io.hueemulation:2.2.0.201711182329]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [35:javax.servlet-api:3.1.0]
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [92:org.eclipse.jetty.servlet:9.3.22.v20171030]
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [92:org.eclipse.jetty.servlet:9.3.22.v20171030]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [195:org.ops4j.pax.web.pax-web-jetty:6.0.7]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [89:org.eclipse.jetty.security:9.3.22.v20171030]
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [195:org.ops4j.pax.web.pax-web-jetty:6.0.7]
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [92:org.eclipse.jetty.servlet:9.3.22.v20171030]
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [195:org.ops4j.pax.web.pax-web-jetty:6.0.7]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.Server.handle(Server.java:534) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [91:org.eclipse.jetty.server:9.3.22.v20171030]
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [83:org.eclipse.jetty.io:9.3.22.v20171030]
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [83:org.eclipse.jetty.io:9.3.22.v20171030]
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [83:org.eclipse.jetty.io:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [94:org.eclipse.jetty.util:9.3.22.v20171030]
    at java.lang.Thread.run(Unknown Source) [?:?]

Most helpful comment

Hi , sorry I missed this one. I'm a few days a way from moving into a new house and have all my stuff, including echos in temp storage why we had some work done on it. Hopefully I'll have things setup up next week to look at this.

All 14 comments

I have this problem as well. After installing openhab 2.2.0 Alexa cannot control the items shared via hue emulation anymore. openhab 2.1.0 worked flawlessly!

@digitaldan Could you have a look?

It seems this line is one of the culprits:

https://github.com/openhab/openhab2-addons/blob/e03584e34b559fbc5a2eb5a6e62af704e5bda41c/addons/io/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/HueEmulationServlet.java#L323

The id is expected to be a numeric formatted string. But indeed it is the item id defined in the items-files (wich is mostly not a numeric value at all).

This change was introduced in c205294f967639720006461fa1128cc0c75287da

Before it was

Item item = itemRegistry.getItem(id);

after:

Item item = itemRegistry.getItem(deviceMap.get(new Integer(id)));

I don't know if this is what causes the problems, but this is what produces the exceptions in openhab.log that @KidSquid1 also printed before.

I just want to make sure I relayed the fact that this issue is intermittent. I have tried to watch and see if I could determine a pattern but as of yet I have yet to recognize one. I will have periods of normal activity where Alexa will respond and turn the requested device on or off. Then I have periods where Alexa will reply....._XXX isn't available_.

Hi , sorry I missed this one. I'm a few days a way from moving into a new house and have all my stuff, including echos in temp storage why we had some work done on it. Hopefully I'll have things setup up next week to look at this.

@digitaldan Any news on this one?

I had the same problem. HueEmu changed the json and the unique IDs & keys inside it. You have to delete the old devices in the alexa App wich had the old (wrong) IDs and start discovery again.

If you start the discovery first all your devices should be doubled.

The old Ids were "names" the new once are just numbers.

Wow, so the solution is to start from scratch? I have dozens of devices to remove, rediscover, rearrange in groups, etc. And all of this twice for my account and that of my wife? Phew. The question is: Why the breaking changes here? Is there no way to be backward compatible?

That's what i realized aber calling the /api/index.html on my openhab. I did this weeks before and remember that the JSON keys and IDs where Strings like "Floor_Light". Why? Shrug!

I don't know if this is "a bug" or an (undocumented) breaking change. Hopefully the IDs will not messed up by adding new Devices.

OK, I can see, that the original hue API also uses numerics as IDs. So I guess this is for compatibility purposes... A backward compatibility and a notification in the changelog would've been nice, though.

ok, I take a look into the code. There are two ways to "add" Items to the hue emulation now. The traditional way by tagging it and a special items file (hueemulation.items) which is read and and written by the IO-addon to keep the information. So, ID seems to be stable. 馃憤

So my question is, why is this intermittent? Devices will respond as they should for a period of time then become unavailable. At some time later they become available again.

@digitaldan or others any idea?

AFAIU the "old" devices are not there anymore and so they will never became available again.

OK, so for me this issue is resolved when I removed and readded all hue emulation devices in Alexa (just like @volkerrichert expected. After this the aforementioned exceptions are gone, too (makes sense, as Alexa is now using the numeric ids).

TL;DR
So, if this ID problem is the core of this bug it can be closed - but it should've been mentioned in the changelog as breaking change!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

UrsusS picture UrsusS  路  5Comments

smyrman picture smyrman  路  4Comments

trailblazer2006 picture trailblazer2006  路  6Comments

martinvw picture martinvw  路  5Comments

Alex5719 picture Alex5719  路  6Comments