wborn / openhab-grafana

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

Webview panel doesn't change on the Android app #10

Closed matthijsvisser closed 5 years ago

matthijsvisser commented 5 years ago

Hi,

I've looked into the closed issues but that didn't fix my problem unfortunately. I'm having some issues with your project with the Openhab Android app. On Chrome and Firefox (Laptop and phone) the desired panel loads when a combo is changed in Openhab. However, in the app the page needs to be reloaded manually to show the selected panel.

Software versions:

I've tried the following:

Note: I'm using port 80 for Pi-hole with lighttpd.

Settings of the app:

Local server URL
http://20.0.0.201:85

sitemap:

Switch item=temp_view 
    mappings=[HOUR="6h", DAY="Day", WEEK="Week", MONTH="Month", YEAR="Year"]
Webview height=9 
    url="/static/demo-combo2.html?dashboardItem=gf_dashboard&fromItem=temp_view&panelItem=gf_panel_temperature"

smarthome-grafana-user-defaults.js:

// the prefix that is used for each Grafana panel URL
SMARTHOME_GRAFANA_DEFAULTS["urlPrefix"] = "http://20.0.0.201:85/grafana";

// use "false" so actual pages are loaded (or comment the line)
SMARTHOME_GRAFANA_DEFAULTS["debug"] = "false";

// use "default" for the default Eclipse SmartHome sitemap (or comment the line)
SMARTHOME_GRAFANA_DEFAULTS["sitemap"] = "default";

if (SMARTHOME_GRAFANA_DEFAULTS["debug"] === "true") {
    console.log("Using SMARTHOME_GRAFANA_DEFAULTS = " + JSON.stringify(SMARTHOME_GRAFANA_DEFAULTS));
}

/etc/nginx/sites-available/default:

server {
    listen 85 default_server;
    listen [::]:85 default_server;
    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;
    server_name _;
        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 /grafana/ {
            proxy_pass http://localhost:3500/;
        }
wborn commented 5 years ago

I've had no issues myself with 2.3.0 and 2.4.0.

Webview height=9 url="/static/demo-combo2.html?dashboardItem=gf_dashboard&fromItem=temp_view&panelItem=gf_panel_temperature"

Did you also try using a fully qualified Webview URL? See https://github.com/wborn/smarthome-grafana/issues/2#issuecomment-276238346.

matthijsvisser commented 5 years ago

Specifying the sitemap page with '&w=000X' solved the issue! Thanks for your help and time!