Webview (Grafana chart) and item selector for timezone not working properly

@noppes123
sorry for the stupid question: which authentication do you mean exactly?
I hope I understood you correctly:
My esp send datas (temp and hum) to my db and then I would like to display the values to my grafana chart in my openhab sitemap. So I think that I dont’ use other sources or external rendering.

:smiley: I was a little brief: I meant Grafana authentication. Best to share your complete grafana.ini so we can verify the settings.

@noppes123:
uff… I have problems to copy my grafana.ini file to the community. :hot_face:
My program WinSCP get allways the error message: " etc/grafana/grafana.ini: Permission denied’ :rage:
Now I have to search a possiblity to copy the file… :nerd_face:

Do you have SSH access as well? Try to connect with that user account.

@noppes123:
Yes, I use putty and I have a ssh access and I just able to open the sudo nano /etc/grafana/grafana.ini file.
Sorry, but I don’t know how can I copy all content of the file and paste it on the community. I tried to select all the content and use copy / paste but it copy allways a part… :flushed:

@noppes123:
Thats my grafana.ini file:
grafana ini.txt (23.1 KB)

Looking back at your earlier posts, I noticed a strange message:

This looks like an InfluxDB query on the same address:port (3000)… did you double check the InfluxDB settings as well?

@noppes123:
Good morning,
Thank you for your support.
I used this tutorial to work with openhab, influxdb and grafana.
Strange that it works when i select the time and update (F5) the website (sitemap).
I will check the whole thing again.

1 Like

Hello @noppes123!
At the moment I have more time and so I can spend more time for my openhab project.
Actually I try to use this code:

sitemap grafana_chart 
        label="grafana chart" {
    Switch item=room1_chartSwitch
           label="Select"
           icon="sofa"
           mappings=[1="week to date",
                     2="the day so far",
                     3="last 5 minutes"]
    Webview icon="none"
            url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now/w&to=now&orgId=1&panelId=2" 
            height=10
            visibility=[room1_chartSwitch==1]   
    Webview icon="none"
            url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now-5m&to=now&orgId=1&panelId=2" 
            height=10
            visibility=[room1_chartSwitch==3,
                        room1_chartSwitch=="Uninitialized" ]   
    Webview icon="none"
            url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now/d&to=now&orgId=1&panelId=2"
            height=10
            visibility=[room1_chartSwitch==2]
}

I add now in the url a refresh of 5s.
When I switch from one time range to a other I get the message “error parsing query: invalid duration” but after some seconds the message disappear (I don’t know why I get this error message :confused:) and I see the grafana chart and is constantly updated.
In the debug mode (F12) of chrome I get regular message like this:

GET http://192.168.178.38:3000/api/datasources/proxy/1/query?db=openhab_db&q=SELECT%20mean("value")%20FROM%20"room1_temperature"%20WHERE%20time%20>%3D%20now()%20-%205m%20GROUP%20BY%20time(1y)%20fill(null)%3BSELECT%20mean("value")%20FROM%20"room1_humidity"%20WHERE%20time%20>%3D%20now()%20-%205m%20GROUP%20BY%20time(1y)%20fill(null)&epoch=ms 400 (Bad Request)

It is possible that is it do do with this:

When I change on my smartphone the time range on the browser I see simultaneous the same change on my browser of the pc. It is impratical.
It is possible to do the change seperatily?

Thank you for the support!!!

Only by having different sitemaps.

I don’t want to annoy you, but I would suggest to be more consistent with formatting.

Short lines:

sitemap grafana_chart 
        label="grafana chart" {
    Switch item=room1_chartSwitch
           label="Select"
           icon="sofa"
           mappings=[1="week to date",
                     2="the day so far",
                     3="last 5 minutes"]
    Webview icon="none"
            url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now/w&to=now&orgId=1&panelId=2" 
            height=10
            visibility=[room1_chartSwitch==1]   
    Webview icon="none"
            url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now-5m&to=now&orgId=1&panelId=2" 
            height=10
            visibility=[room1_chartSwitch==3,
                        room1_chartSwitch=="Uninitialized" ]   
    Webview icon="none"
            url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now/d&to=now&orgId=1&panelId=2"
            height=10
            visibility=[room1_chartSwitch==2]
}

or one Widget per line:

sitemap grafana_chart label="grafana chart" {
    Switch item=room1_chartSwitch label="Select" icon="sofa" mappings=[1="week to date", 2="the day so far", 3="last 5 minutes"]
    Webview icon="none" url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now/w&to=now&orgId=1&panelId=2" height=10 visibility=[room1_chartSwitch==1]
    Webview icon="none" url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now-5m&to=now&orgId=1&panelId=2" height=10 visibility=[room1_chartSwitch==3, room1_chartSwitch=="Uninitialized" ]   
    Webview icon="none" url="http://192.168.178.38:3000/d-solo/BO_TuAgRz/room1?refresh=5s&from=now/d&to=now&orgId=1&panelId=2" height=10 visibility=[room1_chartSwitch==2]
}

Thank you for your answer.
So I have to give every user the link to a specific sitemaps and can’t give a general sitemaps link?

Thank you for your input and your work.
I formated the code now.
The line spacing is the result when I copy and paste my code from visual studio code. How can I change it the line spacing when I paste the code on the community?

Hmm… I don’t get weird spaces when copying from VSCode. Maybe wrong encoding?

I don’t know.
I use in VSocde UTF-8 encoding.

The problem is that there is only one “chart period select” Item, which is common to all users.
If you want different users to have different selector Items available or used, you need different sitemaps.

Thank you for your answer.
Too bad that it doesn’t work “easier”.
For example: When a new user comes in, I always have to create a new sitmap.

Yes, sitemaps are quite restrictive and never designed for multiple users. There aren’t that many home automation requirements for multiple users to want to simultaneously look at different versions of the same chart.

Thank you for your information!

Allow me to draw your attention again to my original “problem”.

In addition I detect that after a indefinite time it is unfortunately no longer possible to switch between the individual times (time range). Pressing the button has no function until I don’t refresh the webpage (sitemaps) again.

In addition I detect that sometimes when I change the time range ( push room1_chartSwitch) on my pc in my sitemap the grafana chart is display scoll bars. But only sometimes…


Thank you for your help!

Are your room1_chartSwitch actions visible in events.log ?