Hueemulation error about failing to create new user after OS update

Hi,

I’m getting the following exceptions every 10 secs in the openHAB log

2018-10-04 14:26:23.251 [INFO ] [binding.hue.handler.HueBridgeHandler] - Creating new user on Hue bridge 192.168.178.28 - please press the pairing button on the bridge.
2018-10-04 14:26:23.255 [WARN ] [binding.hue.handler.HueBridgeHandler] - Failed creating new user on Hue bridge
org.eclipse.smarthome.binding.hue.internal.exceptions.ApiException: API returned unexpected result: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $
        at org.eclipse.smarthome.binding.hue.internal.HueBridge.safeFromJson(HueBridge.java:852) [201:org.eclipse.smarthome.binding.hue:0.10.0.oh230]

192.168.178.28 is the ip-adress of my openHAB box, so the error must come from the hueemulation service.
Pairing is enabled through paper-UI.
Other than these bugging log-entrys the system is working fully normally.

If I uninstall the hueemulation service, the error is gone. But then, amazon echo does not work any longer.

I’m getting this error since I updated the underlying OS from ubuntu server 16.04 lts to 18.04 lts.
Openhab is the 2.3.0 release build (via openhabian), java version is build 1.8.0_181-b13.

Any help is appreciated.

Ok, so I finally solved the issue by myself.

I’ve stopped openhab and edited

/var/lib/openhab2/jsondb/org.eclipse.smarthome.core.thing.Thing.json

I removed the hueemulation part, after restarting OH everything is fine again.

1 Like

I have the same problem after updating OH from 2.3 to 2.4. removing the hue section does not solved the problem.
Every time i restart OH, i get permanently the error.

What i try to solve the Problem:

  1. I tries to remove and reinstall hue bridge
  2. Changed the Ports’s and or redirected them via iptable
  3. Setting a PW manually, bring the pw unknown warning (not really a solution)
  4. ??

Alexa will find the devices with the hue emulation. But i permanently (every second) always get the WARN in OH log.

Any Ideas ?

Cheers,
Erkan

Here my settings:
log error:

0:04:17.326 [INFO ] [hue.internal.handler.HueBridgeHandler] - Creating new user on Hue bridge 11.11.0.3 - please press the pairing button on the bridge.
10:04:17.344 [WARN ] [hue.internal.handler.HueBridgeHandler] - Failed creating new user on Hue bridge
java.io.FileNotFoundException: http://11.11.0.3/api
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.access$200(HttpURLConnection.java:90) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1433) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection$9.run(HttpURLConnection.java:1431) ~[?:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
	at java.security.AccessController.doPrivilegedWithCombiner(AccessController.java:782) ~[?:?]
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1430) ~[?:?]
	at org.eclipse.smarthome.binding.hue.internal.HttpClient.doNetwork(HttpClient.java:130) ~[270:org.eclipse.smarthome.binding.hue:0.10.0.oh240]

config:

createNewUserOnEveryEndpoint=B"false"
discoveryHttpPort="8080"
discoveryIp="11.11.0.3"
pairingEnabled=B"false"
pairingTimeout="60"
restrictToTagsColorLights="ColorLighting"
restrictToTagsSwitches="Switchable"
restrictToTagsWhiteLights="Lighting"
service.pid="org.openhab.hueemulation"

Api - Description output:

<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://11.11.0.3:8080/</URLBase>
<device>
<deviceType>urn:schemas-upnp-org:device:Basic:1</deviceType>
<friendlyName>openHAB Hue Emulation (11.11.0.3)</friendlyName>
<manufacturer>Royal Philips Electronics</manufacturer>
<manufacturerURL>http://www.openhab.org</manufacturerURL>
<modelDescription>Philips hue compatible Personal Wireless Lighting</modelDescription>
<modelName>Philips hue bridge 2015</modelName>
<modelNumber>BSB002</modelNumber>
<modelURL>http://www.meethue.com</modelURL>
<serialNumber>5AA02E257C78</serialNumber>
<UDN>uuid:5aa02e25-7c78-4dd4-ad23-8b72b625d11f</UDN>
<presentationURL>index.html</presentationURL>
<iconList>
<icon>
<mimetype>image/png</mimetype>
<height>48</height>
<width>48</width>
<depth>24</depth>
<url>hue_logo_0.png</url>
</icon>
<icon>
<mimetype>image/png</mimetype>
<height>120</height>
<width>120</width>
<depth>24</depth>
<url>hue_logo_3.png</url>
</icon>
</iconList>
</device>
</root>

The error is from the HUE binding not the hueemulation. And yes the hue binding is very, very broken in that regard and will not work correctly when the hueemulation is also installed. That was fixed in recent snapshots.

Hi David,
does it mean, that i only need to manual install the recent snapshot version of the HUE-Binding to fix my issue? Cheers,
Erkan

That should do it yes. Gab the most recent hueemulation while you are on it.

Now i installed the snapshot version of the HUE-Binding and hue emulation.

penhab> bundle:list | grep -i hue
255 │ Active   │  80 │ 2.5.0.201903170725     │ Hue Emulation Service
270 │ Active   │  80 │ 2.5.0.201903170725     │ hue Binding

Now i ran into another issue - Initial i get the same error, above descripted:

 [hue.internal.handler.HueBridgeHandler] - Failed creating new user on Hue bridge

Then missing User name…

[WARN ] [hue.internal.handler.HueBridgeHandler] - User name for Hue bridge authentication not available in configuration. Setting ThingStatus to OFFLINE.

It is a hue emulation. So i can’t get any password, after pressing a Button. Or is there a Virtual button ;_).

Any ideas?

Here the whole log part:

16:49:53.735 [INFO ] [smarthome.event.InboxAddedEvent      ] - Discovery Result with UID 'hue:bridge:5AA02E257C78' has been added.
16:49:53.734 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'hue:bridge:5AA02E257C78' to inbox.
16:49:55.971 [INFO ] [smarthome.event.InboxRemovedEvent    ] - Discovery Result with UID 'hue:bridge:5AA02E257C78' has been removed.
16:49:55.993 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'hue:bridge:5AA02E257C78' changed from UNINITIALIZED to INITIALIZING
16:49:56.051 [INFO ] [hue.internal.handler.HueBridgeHandler] - Creating new user on Hue bridge 11.11.0.3 - please press the pairing button on the bridge.
16:49:56.056 [WARN ] [hue.internal.handler.HueBridgeHandler] - Failed creating new user on Hue bridge
java.lang.IllegalStateException: already linked
	at org.openhab.binding.hue.internal.HueBridge.link(HueBridge.java:877) ~[270:org.openhab.binding.hue:2.5.0.201903170725]
	at org.openhab.binding.hue.internal.HueBridge.link(HueBridge.java:872) ~[270:org.openhab.binding.hue:2.5.0.201903170725]
	at org.openhab.binding.hue.internal.handler.HueBridgeHandler.createUserOnPhysicalBridge(HueBridgeHandler.java:522) [270:org.openhab.binding.hue:2.5.0.201903170725]
	at org.openhab.binding.hue.internal.handler.HueBridgeHandler.createUser(HueBridgeHandler.java:510) [270:org.openhab.binding.hue:2.5.0.201903170725]
	at org.openhab.binding.hue.internal.handler.HueBridgeHandler.onNotAuthenticated(HueBridgeHandler.java:496) [270:org.openhab.binding.hue:2.5.0.201903170725]
	at org.openhab.binding.hue.internal.handler.HueBridgeHandler$PollingRunnable.run(HueBridgeHandler.java:106) [270:org.openhab.binding.hue:2.5.0.201903170725]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
	at java.lang.Thread.run(Thread.java:745) [?:?]
16:49:56.071 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'hue:bridge:5AA02E257C78' changed from INITIALIZING to OFFLINE (CONFIGURATION_ERROR): Fehler bei der automatischen Generierung eines neuen Benutzers.
16:49:56.628 [WARN ] [hue.internal.handler.HueBridgeHandler] - User name for Hue bridge authentication not available in configuration. Setting ThingStatus to OFFLINE.
16:49:56.640 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - 'hue:bridge:5AA02E257C78' changed from OFFLINE (CONFIGURATION_ERROR): Fehler bei der automatischen Generierung eines neuen Benutzers. to OFFLINE (CONFIGURATION_ERROR): Verbindung zur Hue Bridge kann nicht aufgebaut werden. Es wurde kein Benutzer angegeben.
16:49:57.037 [WARN ] [hue.internal.handler.HueBridgeHandler] - User name for Hue bridge authentication not available in configuration. Setting ThingStatus to OFFLINE.
16:49:57.160 [WARN ] [hue.internal.handler.HueBridgeHandler] - User name for Hue bridge authentication not available in configuration. Setting ThingStatus to OFFLINE.
16:49:57.708 [WARN ] [hue.internal.handler.HueBridgeHandler] - User name for Hue bridge authentication not available in configuration. Setting ThingStatus to OFFLINE.

Your goal is to let the hue binding find all items that are exposed via the hue-emulation service? That is really unusual.

Indeed there is. Use Paper UI and go to the services Hue emulation screen and toggle the respective switch and hit “save”.

Update - I am not able to bring hue binding to create a new user. Also setting the Pairing mode, does not creates a new user. I always get the same error:

[hue.internal.handler.HueBridgeHandler] - Failed creating new user on Hue bridge
java.lang.IllegalStateException: already linked

Anyway, all hue bridge things will be found and they are working also with Alexa. But the log is full of HueBridgeHandler Warnings:

[hue.internal.handler.HueBridgeHandler] - User name for Hue bridge authentication not available in configuration. Setting ThingStatus to OFFLINE.

Can you please explain what you want to archive?

Again: It is very unusual to have the Hue BINDING and the hue-emulation SERVICE.

The first one is for communicating with the Philips Hue bridge where you need to push the physical button to allow new access tokens (“users”) to be generated.

If you did not understand the difference until now, please point to the documentation that confused you so that it can be worded more explicit and detailed.

David, well you are right. The documention indeed did not mentioned, that the Hue Binding is need to get successfull run the Hue Emulation.

After Removing the Hue Binding, every thing is working fine now. I just misunderstod the Hue stuff. :weary:

Thanks. :sunglasses:

ähhh now I did not get it…

  • I have a hue bridge with lamps I want to control
  • I have an amazon echo, which I want to connect

So I need the binding AND the emulation service right? So how I get rid of the error messages?

Many thanks for a short hint

Correct.

Just make sure, that the hue binding is not picking up the hue emulation emulated brigde.

Sorry to ask… and thanks for your response.

How can I make sure that the hue binding is not picking up the hue emulated bridge (as you stated)?
=> I still have the error messages in the log file and I did find no where any reference, to prevent that the hue bridge and the hue binding know about each other?

I uninstalled / reinstalled already the hue-emulated-bridge several times, but this did not help.
Unfortunately OH2 and the Hue-Bridge are in the same network, so they will always see each other. Can I disable this behavior somewhere?

Thanks