Hi,
I am using OH3 on a Raspi 3b and would like to use hue Emulation to control openhab via Alexa without using a cloud (so stay only local).
As my devices were not found I configurated my NGINX as follows
##################################
# openHABian NGINX Configuration #
##################################
server {
listen 80;
server_name localhost;
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;
}
location /api {
# proxy_pass http://192.168.1.100:8080/api/;
proxy_pass http://localhost:8080/api/;
}
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name localhost;
# Cross-Origin Resource Sharing.
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow_Credentials' 'true' always;
add_header 'Access-Control-Allow-Headers'
'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'
always;
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH' always;
# openHAB 3 api authentication
add_header Set-Cookie X-OPENHAB-AUTH-HEADER=1;
## Secure Certificate Locations
ssl_certificate /etc/ssl/certs/openhab.crt;
ssl_certificate_key /etc/ssl/certs/openhab.key;
add_header Strict-Transport-Security "max-age=31536000"; # Remove if using self-signed and are having trouble.
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;
proxy_read_timeout 3600;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Authorization "";
satisfy any;
allow 192.168.0.0/24;
allow 127.0.0.1;
deny all;
## Password Protection
# auth_basic "Username and Password Required";
# auth_basic_user_file /etc/nginx/.htpasswd;
}
## Let's Encrypt webroot location
#WEBROOT location /.well-known/acme-challenge/ { WEBROOT root /var/www/localhost; WEBROOT }
}
# vim: filetype=conf
So far so good.
After deleting all Alexa devices and researching them, they also were found, but I am still not able to control them. Alexa says “device does not reply” resp. in the app “device unreachable” (hope that’s the correct translation for “das Gerät antwortet nicht” resp. “Gerät reagiert nicht”)
As far as I can see is the problem that all my requests from http://MyOhIp:80 are forwarded to https://localhost, and then nothing else happened, as on this device (laptop, mobile phone etc.) no openhab server is running.
Via Hue Essentials app also the devices and the emulated server is found, but when a device is switched I get the failure
"Unhandeled redirect: […] Status: 301 Moved Permanently. […] Nginx/1.10.3,
Which means as far as I can say also that there is a issue with the redirect.
I also tried to replace all “localhost” inside the NGINX with the IP of my Raspi, but unfortunately also without success…
I hope someone can help my out as I am really stucked at this point and am unable to solve the issue on my own
Thanks in advance,
Edizius