Openhab2+Grafana HABdroid Webview

I followed the instruction from here and here on how to install and configure InfluxDB and Grafana for my RPI3, consulting grafana-on-raspberry for up do date install instructions and had some further reading on influxDB or Grafana .

I run InfluxDB, Grafana and OpenHAB on the RPI3.

As the webview element in Android App did not log in and showed the loggin credentials i thought of setting up the webview url with user credentials.

Calling the url from the browser got me a warning that the page does not accept login credentials which leaded me to this post which states to disable the basic authentification.

sudo nano /etc/grafana/grafana.ini
#################################### Users ####################################
[users]
# disable user signup / registration
allow_sign_up = false

...
#################################### Anonymous Auth ##########################
[auth.anonymous]
# enable anonymous access
enabled = true

...
#################################### Basic Auth ##########################
[auth.basic]
enabled = false


[security]
allow_embedding=true

Restart grafana and close the App!!!

systemctl restart grafana-server.service

So this made gafana work also in the AndroidApp

Frame{ Webview height=10
       url="http://<IP_HOST>:3000/dashboard-solo/db/<PANELNAME>?panelId=<PANELID>& <...>
}

This is the sitemap view in the browser.

This is the sitemap view in the App.

Thank you @ThomDietrich for the nice tutorial. Maybe this was allready known, but i could not find anything about it.

EDIT: @jeffstagedoor added it to the grafana config

12 Likes

Hello,

i followed your instructions and i get the graph displayed in the app but with the options menu from above that enables you to chose the time range and the dashboard (marked with a red frame in the picture) . this is how i declared my webwiew element :

Webview  height=10 url="http://user:password@192.168.0.45:3000/dashboard/db/first?refresh=5s&panelId=3&fullscreen&edit&orgId=1&tab=general&from=1508498834960&to=1508585234960"

This is displaying the following both in android and ios apps :

Do you have any idea how get rid of the section marked with red and keep only the plot (marked with purple)?

Thanks in advance.

ps : that section i want away si being displayed also in the browser.

the the picture from the android app.

@Adi_Vacaru have a closer look to my link, use dashboard-solo and not dashboard.

3 Likes

that does it. thanks a lot.

@Adi_Vacaru feel free to mark the post as solution. And maybe spend a like for a post you got some good information from. :wink:

1 Like

sorry for the noob question but how do i mark it as a solution ?


The gray box at the bottom left with the check mark hover over it and see the text “this reply solves the problem”

i don’t have that one :

Not working for me :frowning_face:
Even I setup a separate user and changed basic auth to “false” I allways get the login screen when attempting the url directly within browser. (When I first login and then go to the URL I get the chart perfectly, even with http://“user”:“password”@ within URL)
When using the webview element within sitemap I get a blank frame.

My URL:
http://“user”:“password”@:2ipAdress23000/dashboard-solo/db/raumtemperaturen?orgId=1&panelId=1&from=now-1d&to=now&theme=dark

Sitemap:
Frame label=“Raumtemperaturen” {
Webview height=15 url=“http://:@:3000/dashboard-solo/db/raumtemperaturen?orgId=1&panelId=1&from=now-1d&to=now&theme=dark”
}

I don’t really get it. Why do you need to provide user credentials?

I use this link:

http://192.168.X.X:3000/dashboard-solo/db/alarm-logging?orgId=1&from=now-1M&to=now&panelId=2&theme=light

It doesn’t require user credentials and works fine.

@marschall_philipp didi you get it running?
What is was your setup? Android Client and RPI server?

1 Like

No, haven´t been successful. I then turned on the anonymous access (or how ever it is called…). So I don´t have to provide any credentials.
My setup was / is RPI3 as OpenHab+Grafana Server and the Android Client and Web Access to OpenHab.

I also did not get it successfully use the anonymous credentials and then I found out you have to match in the [auth.anonymous] section the [org_name] value to be exact value defined in Grafana dashboard org.

Which anonymous credentials, you just open the link without any credential.

As for me i set it up yesterday on an RPI3 ans di just the changes above and it worked.

Sorry @Josar can you explain better the “dashboard-solo” issue?
I can’t get it to work. If i use “dashboard” it works, with “dashboard-solo” the sitemap don’t show errors, but it shows me an empty image.

@Josar - my fault, don’t know why but the url shared from the “public” view mode (i mean, not logged in), was different.
The url comes with a “&fullscreen” at the end, that can create problem.
If i use dashboard-solo without &fullscreen in the end, works perfectly.

Thank you

Hello
Ip_host - local IP openhab server or white ip external ???

IP of the system where Grafana is running.