knitone
(Knut)
January 24, 2023, 9:43pm
1
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.
MikeJMajor
(Mike Major)
January 24, 2023, 10:02pm
2
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?
knitone
(Knut)
January 25, 2023, 12:32pm
3
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
MikeJMajor
(Mike Major)
January 25, 2023, 7:49pm
4
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.
knitone
(Knut)
January 25, 2023, 8:13pm
5
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
knitone
(Knut)
January 25, 2023, 8:41pm
6
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…
knitone
(Knut)
January 25, 2023, 8:52pm
7
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?
MikeJMajor
(Mike Major)
January 26, 2023, 7:00am
9
If Alexa won’t pair then it might be an issue with your nginx configuration. Can you post your configuration.
knitone
(Knut)
January 26, 2023, 7:15am
10
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…
MikeJMajor
(Mike Major)
January 26, 2023, 8:31am
11
I’m not sure that’s correct. Have a look at this which has a working solution:
Seems as I’ve been able to fix the fragile system.
use in section 80 no 301 forward, but only the sections from hue emulation manual.
→
server {
listen 80;
location /api {
proxy_pass http://192.168.0.10:8080/api/;
}
location / {
proxy_pass http://192.168.0.10:8080/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forward…
knitone
(Knut)
January 26, 2023, 9:18pm
12
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
Anno_Nym
(Anno Nym)
January 29, 2023, 10:54am
13
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
1 Like