Hue bridge and lamps offline after OH 2.2 update

Since I’ve updated my Openhabian to version 2.2 my Hue bridge and a lot of the lamps are displayed as offline in Paperui after the first command is sent. I’ve enabled the trace log but found no errors. Also sending additional commands seams to work, but some of the lamps do not react to the commands. When using the official Hue app everything works as expected.

Is anyone having the same problems?

Edit: My guess is that the offline state is just false. If I switch the lamps individually everything works, but if I switch the lamps using groups it often happens that not all lamps switch on or off. (But the items in Openhab are updated)

This is the error that is displayed on the bridge: Connection reset by peer (connect failed)

And the firmware version of the bridge is 01038802.

No for me it works fine…

I’ve reverted back to the hue binding 0.9.0.b1, that seams to have fixed the problem that the devices are displayed as offline. But I still got a problem when switching on/off a group with a lot of lamps. (12 lamps in this case)

With the older binding I now also get errors in the openhab.log when switching the group with a lot of lights:

java.lang.RuntimeException: java.io.IOException: Error writing to server
	at org.eclipse.smarthome.binding.hue.handler.HueBridgeHandler.updateLightState(HueBridgeHandler.java:199) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at org.eclipse.smarthome.binding.hue.handler.HueBridgeHandler.updateLightState(HueBridgeHandler.java:196) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at org.eclipse.smarthome.binding.hue.handler.HueLightHandler.handleCommand(HueLightHandler.java:265) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at sun.reflect.GeneratedMethodAccessor182.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at com.sun.proxy.$Proxy197.handleCommand(Unknown Source) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [122:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [122:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.io.IOException: Error writing to server
	at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:699) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.writeRequests(HttpURLConnection.java:711) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1585) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[?:?]
	at nl.q42.jue.HttpClient.doNetwork(HttpClient.java:50) ~[?:?]
	at nl.q42.jue.HttpClient.put(HttpClient.java:28) ~[?:?]
	at nl.q42.jue.HueBridge.setLightState(HueBridge.java:232) ~[?:?]
	at org.eclipse.smarthome.binding.hue.handler.HueBridgeHandler.updateLightState(HueBridgeHandler.java:194) ~[?:?]
	... 19 more
2017-12-21 19:10:39.154 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.eclipse.smarthome.binding.hue.handler.HueLightHandler@dab00e': java.net.SocketException: Connection reset by peer (connect failed)
java.lang.RuntimeException: java.net.SocketException: Connection reset by peer (connect failed)
	at org.eclipse.smarthome.binding.hue.handler.HueBridgeHandler.updateLightState(HueBridgeHandler.java:199) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at org.eclipse.smarthome.binding.hue.handler.HueBridgeHandler.updateLightState(HueBridgeHandler.java:196) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at org.eclipse.smarthome.binding.hue.handler.HueLightHandler.handleCommand(HueLightHandler.java:265) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at sun.reflect.GeneratedMethodAccessor182.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at com.sun.proxy.$Proxy197.handleCommand(Unknown Source) [258:org.eclipse.smarthome.binding.hue:0.9.0.b1]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [122:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [122:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at sun.reflect.GeneratedMethodAccessor159.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [115:org.eclipse.smarthome.core:0.10.0.b1]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: java.net.SocketException: Connection reset by peer (connect failed)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
	at java.net.Socket.connect(Socket.java:589) ~[?:?]
	at sun.net.NetworkClient.doConnect(NetworkClient.java:175) ~[?:?]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) ~[?:?]
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) ~[?:?]
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:242) ~[?:?]
	at sun.net.www.http.HttpClient.New(HttpClient.java:339) ~[?:?]
	at sun.net.www.http.HttpClient.New(HttpClient.java:357) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1334) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1309) ~[?:?]
	at nl.q42.jue.HttpClient.doNetwork(HttpClient.java:45) ~[?:?]
	at nl.q42.jue.HttpClient.put(HttpClient.java:28) ~[?:?]
	at nl.q42.jue.HueBridge.setLightState(HueBridge.java:232) ~[?:?]
	at org.eclipse.smarthome.binding.hue.handler.HueBridgeHandler.updateLightState(HueBridgeHandler.java:194) ~[?:?]
	... 19 more

I think this is what was causing the offline state on the newer binding. The older binding just seams to set this error to the thing state and set it offline instead of writing a log entry. Because I only get this error when switching a lot of lights in a group I changed my rule that every light is switched separately and I’ve added a timeout in between like this:

COLOR_HUE_Living_VL.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_VR.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_HL.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_HR.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_1.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_2.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_3.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_4.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_5.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_6.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_7.sendCommand(OFF)
Thread::sleep(100)
COLOR_HUE_Living_8.sendCommand(OFF)

It seams that this solved the problem. My guess is that the HUE bridge now blocks multiple http request that are sent in short time after the latest firmware update.

@Kai Could you please take a look at this?

0.9.0.b1 is probably not fully compatible with OH 2.2.0, so I would not recommend to do testing or bug analysis with it.

Could you enable hue debug logs (log:set DEBUG org.eclipse.smarthome.binding.hue) and get the openhab.log and event.log excerpts when sending a command? Please directly create an issue at https://github.com/eclipse/smarthome/issues with this information. Thanks!

Hi Kai, I was now able to reproduce the error without Openhab simply by using the Chrome ARC plugin. I just rapidly sent a light off http put request to the hue bridge and then the requests where aborted after 3 or 4 requests. I will file an issue on GitHub for this.

Edit: Issue is created: https://github.com/eclipse/smarthome/issues/4794

1 Like

I found out that a delay of 25 miliseconds after every command solves the problem. (see https://github.com/eclipse/smarthome/issues/4794

I also found an article from Philipps describing how delays should be added: https://developers.meethue.com/documentation/hue-system-performance

Your HUE Bridge Firmware seems to be very old :wink:

Current firmware version: 1711151408

Update your Bridge and than give Openhab a next try :slight_smile:

I assume you have the V2 bridge. I still habe the V1 where this is the latest firmware version: https://www2.meethue.com/en-us/support/release-notes/bridge

Okay … perhaps than the V1 work don’t properly with the actual Binding.
With V2 there are no problems :slight_smile:

404 :wink:

Hue works here with release 2.2 better than before - e.g. dimmer item issues solved, and responds faster!
Hue V2 bridge, my SW release 1711151408

Sorry, something with the link went wrong. This is the link: https://github.com/eclipse/smarthome/issues/4794

Sadly I can’t test with an V2 bridge, but if the addons is faster since the update this could exactly be the source of my problem. If the V1 bridge has a limit how much commands per second can be processed and the addon now sends the commands faster then commands are being dropped. (I had “connection reset by peer” errors exactly on the lamps that did not switch)

With the addon version I build myself everything is now working like in previous versions. Lights switch with a slight delay again, but more important they all switch and I don’t have to press the light button three times for all lights to turn on or off.

Thanks for this post. I have been seeing intermittent issues with my Hue binding and haven’t had time to troubleshoot it yet and it has been driving me crazy. I’ve ordered a V2 hub and will update if this solves my problems.

If your hue things suddenly all (or most) go offline then I suppose you have the same problem as I. I could provide you my modified hue addon where I’ve added a timeout which solves the problem for me.

That is exactly what they have been doing. I assume the V2 hub will fix the issue, otherwise I will take you up on the modified addon.

Thanks!

Dear David!

I would like to get your modified hue addon. Do you actually know if the “official” hue binding will be adjusted, so V1 bridges work again properly?

Regards,
Herbert

Hi Herbert, I uploaded my modified addon to my Dropbox. You can download the addon using this Link.

I hope the problem will be resolved soon. My fix is just a quick workarround which should be made better. (See here)

1 Like

Hi David!

Thank you - working!

I had the same issue as well, and this binding workaround fixed it. Thanks