wborn / openhab-grafana

JavaScript utilities and examples for using Grafana with openHAB
MIT License
46 stars 13 forks source link

External (i.e. non-network local access) #3

Closed FHeilmann closed 7 years ago

FHeilmann commented 7 years ago

Hi, thanks for this work. Is there any way to make it work when not connected to the network the Smart Home device is in?

I have a raspberry pi running openhab and grafana. Openhab is accessible from outside the network behind authentication. Unfortunately, I cannot view any graphs provided by this script as the adresses, of course, make no sense if you are trying to view them from outside the local network.

Any suggestions? Or am I simply out of luck here?

wborn commented 7 years ago

Here's a description of how I use openHAB+Grafana+Library internally and externally. Hopefully that helps you out a bit!

My router uses NAT to proxy all traffic on 443 to my RPi.

On my RPi runs an Apache proxy that takes care of all HTTP Basic Auth and encrypts all traffic using Let's Encrypt certificates. Based on the URL path it proxies traffic either to the openHAB or Grafana port.

I've configured Grafana to run on /grafana/ instead of / . Grafana is also configured to use the Basic Auth of Apache.

When I access openHAB internally/externally it is always done using the same hostname (which resolves to my external router IP). This way the same Webview URL can be used internally/externally.

I use exactly the same library code that is available in GitHub. I don't use myopenhab or openhabian myself.

FHeilmann commented 7 years ago

Thanks for your reply. I am using nginx as my reverse proxy but I'll try to make it work there, too.