OpenHab 3. Setting up Hue Emulation

  • Platform information:
    • Hardware: Raspberry Pi 3 Model B Rev 1.2
    • OS: Raspbian GNU/Linux 10 (buster) installed from image Openhasbian
    • openHAB version: OpenHAB 3

Trying to configure Hue Emulation. Cannot find any docs on it for OH3. Everything talks about paper UI.
The Binding is installed and creating a Thing and Save I get:
CONFIGURATION_ERROR
Failed to create new user on Hue bridge.
If I enter a user and Save I get:
CONFIGURATION_ERROR
Authentication failed. Remove user name from configuration to generate a new one.

The goal is to expose my devices for Alexa without using the OpenHAB Cloud. I have read this is possible prior to OH3.

I think you might be confusing the Hue Binding with the Hue Emulation Service.

The binding is for connecting openHAB to a physical Hue hub. The Emulation Service is for making openHAB items available to Alexa and Google Assistant. Here’s the documentation:

To install it, go to “Misc” in the MainUI settings. It’ll be one of the services you can install. You don’t need the Hue Binding for this to work, so you can uninstall that.

image

I don’t use Hue emulation, in large part because you can only expose a handful of item types that don’t meet my needs. The Alexa and Google Assistant integrations offer more item types, such as fans and door locks.

To expose specific items, add the appropriate tags. The documentation shows text configuration, and I’m guessing that in MainUI you would edit the item and add a Non-semantic Tag.

That’s all the help I can offer, since I don’t use this. Hope you get it working!

Thanks for the reply but nope, no confusion on that front.

Like I said, I get to the point where I create a Thing.
In Settings → Things → openHAB Hue Emulation
Status OFFLINE
CONFIGURATION_ERROR
Failed to create new user on Hue bridge.
If I insert a username and save then I get
Status:
OFFLINE
CONFIGURATION_ERROR
Authentication failed. Remove user name from configuration to generate a new one.

So OH3 will not take a username and is not creating one for it’s self.

Oh yeah, the current Hue Emulation does allow many items like locks etc.

Hi,
I have exactly the same problem with Hue Emulation. The screen shot illustrating it is here:

I think the problem is about “Network Address” field. If I enter there the address of my real Hue Bridge (I have that on my network) and press button on the real bridge - I will pair my Hue Emulation with the real Hue Bridge and no problem reported (green status of the hue emulation). However, after a reboot of OpenHab, the IP is changing back to local IP and I am getting back to the problem on the screen attached.
Could anyone suggest a trick?
Thanks a lot in advance,
@xm

Interesting because I was under the impression that the Hue Emulation was to be used instead of an actual Hue Bridge. I think you want the Hue Binding, it will connect to the Hue Bridge and allow control of all your HUE Things.

I want to use it to export all my devices, as Hue Devices, to Alexa and had no intention of ever getting a Hue Bridge.

I need all of them to work - Hue Emulation and Hue Bridge + Hue Binding. BTW, Hue Bridge with Hue Binding work with no any problem.

I have the same problem on an RPi4, OpenHab 3.2 via openhabian.
I cannot create a new user.

To me the user bit worked by putting in “testuser” and putting in 8080 as a port. Inbox is full with the exposed devices too through the emulated hue hub.
I can reach the lights through both port 80 and 8080, no difference through a web browser.

But Alexa still doesn’t discover the devices for some reason and it did work in 2.5… If anyone has an idea what else to do, please don’t hesitate to share…
I can see it polling through the message.log, ports are open but something is wrong…

Have you read the documentation for the Hue Emulator about requiring nginx to get Alexa discovery working?

This wasn’t required for 2.5, but is for 3.x

Thank you, that was a good hint. Alexa seems to have access to the RPI, but still can’t discover the items.
I can see the lights and sensors exposed on port 80:
http://192.168.0.xx/api/status/lights/24 or /lights expose everything, no problem.

I can also see loads of stuff like this on the /api/status page

  • 045ee08b-10f9-4e4f-8b37-203e263f56e6 Echo#openhab 2022-05-08T11:27:58.230671
  • 0e614ca2-244f-453d-a8bf-73a900ab7a56 Echo#openhab
  • 156a5ee3-8bdc-4feb-ba6d-45cf360199c4 Echo#openhab
  • 17232992-7c9e-490d-b85f-12001d15347e On-the-go-user#openhab 2022-05-07T12:08:59.472869
  • 174a1d7f-ccf9-443d-b646-4658d7d86736 Echo#openhab
  • 194e6bde-162e-423a-8b2e-d45c9e434d60 Echo#openhab
  • 1b7f9017-f3e1-4439-81c1-6ce32ce0f2d0 Echo#openhab
  • 1b97e900-6c3d-40d0-a291-012c28b02787 Echo#openhab
  • 1d075d67-93bb-4a6f-af07-4284096cbdc1 Echo#openhab

But still it doesn’t seem to discover the items. I have kept the same items configuration as with 2.5, so they should be discoverable.

state
on false
reachable true
mode homeautomation
alert none
type On/off light
modelid Plug 01
uniqueid ab790618-cdef-1979-0618-abcdef123456-78-18
manufacturername OSRAM
productname On/Off plug
swversion V1.04.12
hascolor false
name Shutters
config
archetype classicbulb
function functional
direction omnidirectional
capabilities
certified false
streaming
renderer false
proxy false
control {}

The only “odd” thing on the status page is this:

UPnP discovery test

service not registered

But at the same time in the openhab.log I get it:
Hue Emulation UPNP server started on 192.168.0.xx:8080

in the log I get this error though:
2022-05-08 12:40:07.798 [WARN ] [ache.cxf.phase.PhaseInterceptorChain] - Interceptor for {http://[fe80:0:0:0:1874:a73c:3d00:8bc4]/description.xml}WebClient has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:67) ~[?:?]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[?:?]
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:703) ~[?:?]
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1086) ~[?:?]
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:932) ~[?:?]
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:901) ~[?:?]
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:461) ~[?:?]
at org.apache.cxf.jaxrs.client.SyncInvokerImpl.method(SyncInvokerImpl.java:135) ~[?:?]
at org.apache.cxf.jaxrs.client.SyncInvokerImpl.method(SyncInvokerImpl.java:130) ~[?:?]
at org.apache.cxf.jaxrs.client.SyncInvokerImpl.get(SyncInvokerImpl.java:50) ~[?:?]
at org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.get(InvocationBuilderImpl.java:88) ~[?:?]
at org.openhab.io.hueemulation.internal.upnp.UpnpServer.performAddressTest(UpnpServer.java:280) ~[?:?]
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642) [?:?]
at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479) [?:?]
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) [?:?]
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) [?:?]
at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) [?:?]
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) [?:?]
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) [?:?]
Caused by: java.net.ConnectException: ConnectException invoking http://[fe80:0:0:0:1874:a73c:3d00:8bc4]/description.xml: Connection refused (Connection refused)
at jdk.internal.reflect.GeneratedConstructorAccessor401.newInstance(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1400) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1384) ~[?:?]
at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77) ~[?:?]
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:671) ~[?:?]
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) ~[?:?]
… 18 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[?:?]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[?:?]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[?:?]
at java.net.Socket.connect(Socket.java:609) ~[?:?]
at sun.net.NetworkClient.doConnect(NetworkClient.java:177) ~[?:?]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:474) ~[?:?]
at sun.net.www.http.HttpClient.openServer(HttpClient.java:569) ~[?:?]
at sun.net.www.http.HttpClient.(HttpClient.java:242) ~[?:?]
at sun.net.www.http.HttpClient.New(HttpClient.java:341) ~[?:?]
at sun.net.www.http.HttpClient.New(HttpClient.java:362) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1232) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520) ~[?:?]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527) ~[?:?]
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:377) ~[?:?]
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream$2.run(URLConnectionHTTPConduit.java:373) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:373) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1598) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1571) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1371) ~[?:?]
at org.apache.cxf.io.AbstractWrappedOutputStream.close(AbstractWrappedOutputStream.java:77) ~[?:?]
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) ~[?:?]
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:671) ~[?:?]
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) ~[?:?]
… 18 more

The uniqueid value is too big for Alexa discovery to work and looks to be left over from your old 2.5 configuration.

In advanced Hue Emulation settings, delete the Unique Bridge ID and save the settings. Then restart openHAB and it will generate a new shorter id which works with Alexa.

That did it, thank you very much, I’d never have figured it out! Thanks a lot!