OH3 with hue emulation for Alexa

Hi there,

after years with a working OH2 I turned to OH3 and tried to run hue emulation for Alexa - without success.
I installed nginx already as a proxy to run OH on port 80.

I see the status page on http://192.168.1.5/api/status with success.

But if I try to show the lights on http://192.168.1.5:8080/api/testuser/lights
I get this error:

[{“error”:{“address”:“testuser/lights”,“description”:“Not Authorized”,“type”:1}}]

And I think this is one of the errors that my Alexa cannot find the devices.

I user an .item-file from OH 2x. Could this be one of the problem?

I think I need some help.

Thanks.

Did you add the request URL mapping for /api as mentioned in the documentation? If you don’t have that correct Alexa discovery will not work.

Did you try putting the Hue Emulation in pairing mode before clicking the link?

Hi Mike,

thanks for your reply.

Yes, I added the path in the nginx config and I activated the pairing mode. I was not sure if I only need the pairing mode or also the V1-Version. But I tried everything!

BR

If you look in $OPENHAB_USERDATA/jsondb/hueEmulationUsers.json do you see entries refering to testuser and Echo?

If not then the pairing hasn’t worked. I’d suggest trying to pair again with “Add Unknown User-keys” enabled.

Try both http://192.168.1.5:8080/api/testuser/lights and Alexa to see if you get users added.

Hi,

Should it be an file? There is a path: /srv/openhanded-userdata/jsondb/

In this directory is no file with that name. Only users.json, when I look for „users

Maybe that‘s the problem. I tried already to reinstall the binding.

BR

Edit: Something new!
I played with the pairing parameters. Now I see the items in http://192.168.1.5:8080/api/testuser/lights
And also the hueEmulationUsers.json:
testuser": {
“class”: “org.openhab.io.hueemulation.internal.dto.HueUserAuthWithSecrets”,
“value”: {
“apiKey”: “testuser”,
“name”: “On-the-go-user#openhab”,
“createDate”: “2023-01-25T21:18:37.978314”,
“lastUseDate”: “2023-01-25T21:30:06.256076”,
“clientKey”: “testuser”
}
}
}

But further no pairing.

I tried all parameters in different combinations for pairing…

And the last one for tonight:
On the status site is another hint:

UPnP discovery test

service not registered

How can I fix this?

Are you blocking the port by chance?

If Alexa won’t pair then it might be an issue with your nginx configuration. Can you post your configuration.

Here it is:
server {
listen 80;
location / {
proxy_pass http://localhost:8080/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

server {
listen 80;
location /api {
proxy_pass http://localhost:8080/api/;
}
}

I found this configuration somewhere and the ports are working. I thought with the right content…

I’m not sure that’s correct. Have a look at this which has a working solution:

Hi Mike,

That was a great hint.

I copied the nginx config to my server. And now it is running. I‘m not sure about the difference of this two configs. How ever, it is working.

Thank you very much for you help.

BR

For me running openhab on port 80 is solving the alexa-hue-emulation issues. So there is no need for nginx if you do it like this