Searching for help with grafana with openhabian


Im looking for an up to date tutorial for making graphs in Openhabian with the RPI3

Is this still valid:


But to share my point of knowledge here… Im already stuck at:
Following the installation instructions , start by adding the InfluxData repository and installing InfluxDB on your monitoring-host .
As i dont even know what is a monitoring-host. :worried:

Im trying to get something which Home assistant has right out of the box, some nice history and graphs which show my temperatures in history. I feel that i am just not seeing something as its so easy with HA but with OH i need to do a lot of “coding”

On youtube, nor here i cannot find a simple explanation on how to get graphs to show in OH (which tells more about me than about YT or this community).

Im running Openhab 2.4 on a freshly installed RPI3b
I have 5 zwave devices which all show up in PaperUI and i have been able to get them nicely in HabPanel as well. I have even managed to get a shared network drive on my WIN10 pc that shows the content of the openhab-conf directory and i installed Visual studio code, and added the openhab extension. Thanks to several tutorials though.

But now i cannot find some clear info on how to use influxdb (i dont even know what it is) and how to get it to work with something like Grafana.

I added Influxdb via addon > persistence.
But it does not show up when i want to select the default persistence in System, neither after a reboot.

If anybody would be so kind to get me into the right direction it would be so nice.

Thank you.

So let’s get started with some basic information:
The way it will work is, that openhab will store values from your devices/sensors/lamps in a database, including a timestamp.
The database used in the tutorial you posted is called influxdb. It is dedicated to data that is in form of a time series (just what we want). It will delete old measurements after some time to make space for new ones.
So openhab already comes with some magic as it will do the storing of values automatically, once you told it where your database is.
To set up the database, just follow the tutorial you posted.
The monitoring host will be your raspberry pi as this is where the database should be hosted. After installing influxdb from paperUI, just open a remote shell or remote shell on your raspberry and execute the command “influx”, it will take you to the influxdb command line interface where you can run all the commands to set up users and so on, just as shown in the tutorial.
Later, grafana will connect to the database (your influxdb) and get the data out.

So best would be you try to work through the tutorial as far as you get and then post the specific point where you’re stuck.

1 Like

Thank you BobMiles for your answer.
ok, i will try to get my issues on paper.

clicking on the installation instructions tells me the information is outdated. Should i click on the InfluxDB v1.7 or not (maybe the OP could update the link in that case)

In PaperUI i installed InfluxDB (V 1.0) persistence (persistence-influxdb - 1.13.0
in the log it shows as:
2018-12-25 22:41:47.769 [thome.event.ExtensionEvent] - Extension ‘persistence-influxdb’ has been installed.

after this is done, there is no posibilty to enable any default persistence in the system settings. Neither after a reboot.
Going with SSH and give command influx or sudo influx. i get Command not found.

So glad for your help already!

Influxdb is not installed when you install the influxdb persistence service in paperUI. This is only the connection that will write and handle the database.
As suggested in the tutorial, you have to install influxdb manually:

Afterwards you can use the influx command and go on in the tutorial.

1 Like

as this is for debian jessie i am wondering…

while searching on Google, i see that it is possible to use the openhabian-config and use #24 InfluxDB-Grafana.

Would this be a safer option for me?

Oh yes of course! Sorry I don’t remember exactly how many of the steps is integrated in the openhabian-config…

1 Like

so far:
sudo openhabian-config.
go to #24, install influxdb+grafana (it will tell to go to this post: InfluxDB+Grafana persistence and graphing )

its asking me to install locally or use existing instance.
no idea what to pick so i try the first one. Install locally.

enter passwords for a few times. I enter all the same password for each of them.

Shall influxDB be configured with Openhab? I select Yes

Operation Succesful!

If this is all correct, how can we add this into the tutorial so that others can benefit from this as well?,

[22:52:12] openhabian@openHABianPi:~$ sudo openhabian-config
2018-12-25_22:53:17_EET [openHABian] Checking for root privileges… OK
2018-12-25_22:53:17_EET [openHABian] Loading configuration file ‘/etc/openhabian.conf’… OK
2018-12-25_22:53:18_EET [openHABian] openHABian configuration tool version: [master]v1.4.1-430(67ea550)
2018-12-25_22:53:18_EET [openHABian] Checking for changes in origin… OK
2018-12-25_22:53:23_EET [openHABian] Setting up InfluxDB and Grafana…

Installing InfluxDB…

$ apt -y install apt-transport-https
Reading package lists… Done
Building dependency tree
Reading state information… Done
apt-transport-https is already the newest version (1.4.8).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
–2018-12-25 22:57:34--
Resolving (… 2600:9000:2074:1200:7:7790:e740:93a1, 2600:9000:2074:7800:7:779 0:e740:93a1, 2600:9000:2074:ca00:7:7790:e740:93a1, …
Connecting to (|2600:9000:2074:1200:7:7790:e740:93a1|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 3108 (3.0K) [application/pgp-keys]
Saving to: ‘STDOUT’

  •                         100%[=================================================>]   3.04K  --.-KB/s    in 0s

2018-12-25 22:57:34 (76.7 MB/s) - written to stdout [3108/3108]


$ apt update
Hit:1 stretch InRelease
Hit:2 stretch InRelease
Ign:3 stable InRelease
Hit:4 stable Release
Get:5 stretch InRelease [4,732 B]
Ign:6 stable InRelease
Hit:7 stretch InRelease
Hit:8 stable Release
Get:10 stretch/stable armhf Packages [918 B]
Fetched 5,650 B in 2s (1,928 B/s)
Reading package lists… Done
Building dependency tree
Reading state information… Done
All packages are up to date.

$ apt -y install influxdb
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 43.0 MB of archives.
After this operation, 93.2 MB of additional disk space will be used.
Get:1 stretch/stable armhf influxdb armhf 1.7.2-1 [43.0 MB]
Fetched 43.0 MB in 39s (1,101 kB/s)
Selecting previously unselected package influxdb.
(Reading database … 46236 files and directories currently installed.)
Preparing to unpack …/influxdb_1.7.2-1_armhf.deb …
Unpacking influxdb (1.7.2-1) …
Setting up influxdb (1.7.2-1) …
Created symlink /etc/systemd/system/influxd.service → /lib/systemd/system/influxdb.service.
Created symlink /etc/systemd/system/ → /lib/systemd/system/influxdb.service.
Processing triggers for man-db ( …
Updating FireMotD available updates count … 2018-12-25 22:58:40,519: FireMotD: Error: Template folder doesn’t exist. U pgrading from an older version? Please run make again or run the install function “FireMotD -I -v”.

$ systemctl daemon-reload

$ systemctl enable influxdb.service

$ systemctl restart influxdb.service
OK Configure InfluxDB admin account… {“results”:[{“statement_id”:0}]}
OK Configure listen on localhost only…
$ sed -i -e /^# Determines whether HTTP endpoint is enabled./ { n ; s/^# enabled = true/enabled = true/ } /etc/influxdb/ influxdb.conf

$ sed -i s/# bind-address = “:8086”/bind-address = “localhost:8086”/g /etc/influxdb/influxdb.conf

$ sed -i s/# auth-enabled = false/auth-enabled = true/g /etc/influxdb/influxdb.conf

$ systemctl restart influxdb.service
Setup of inital influxdb database and InfluxDB users… {“results”:[{“statement_id”:0}]}
OK Installing Grafana…
$ wget
–2018-12-25 22:59:07--
Resolving (…
Connecting to (||:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 27059330 (26M) [application/x-debian-package]
Saving to: ‘grafana_5.3.4_armhf.deb’

grafana_5.3.4_armhf.deb 100%[========================================================================================================================================>] 25.81M 393KB/s in 42s

2018-12-25 22:59:50 (633 KB/s) - ‘grafana_5.3.4_armhf.deb’ saved [27059330/27059330]

$ apt update
Hit:1 stretch InRelease
Ign:2 stable InRelease
Hit:3 stretch InRelease
Hit:4 stable Release
Hit:5 stretch InRelease
Hit:6 stretch InRelease
Ign:7 stable InRelease
Hit:8 stable Release
Reading package lists… Done
Building dependency tree
Reading state information… Done
All packages are up to date.

$ apt-get install -y adduser libfontconfig
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘libfontconfig1’ instead of ‘libfontconfig’
adduser is already the newest version (3.115).
libfontconfig1 is already the newest version (2.11.0-6.7).
libfontconfig1 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

$ dpkg -i grafana_5.3.4_armhf.deb
Selecting previously unselected package grafana.
(Reading database … 46262 files and directories currently installed.)
Preparing to unpack grafana_5.3.4_armhf.deb …
Unpacking grafana (5.3.4) …
Setting up grafana (5.3.4) …
Adding system user grafana' (UID 112) ... Adding new usergrafana’ (UID 112) with group grafana' ... Not creating home directory/usr/share/grafana’.

NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable grafana-server

You can start grafana-server by executing

sudo /bin/systemctl start grafana-server
Processing triggers for systemd (232-25+deb9u6) …

$ systemctl daemon-reload

$ systemctl enable grafana-server.service
Synchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable grafana-server
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/grafana-server.service.

$ systemctl start grafana-server.service
Updating Grafana admin password…{“message”:“User password updated”}OK Updating Grafan configuration…
$ sed -i -e /^# disable user signup / registration/ { n ; s/^;allow_sign_up = true/allow_sign_up = false/ } /etc/grafana/grafana.ini

$ sed -i -e /^# enable anonymous access/ { n ; s/^;enabled = false/enabled = true/ } /etc/grafana/grafana.ini

$ systemctl restart grafana-server.service
Connection Grafana to InfluxDB…{“datasource”:{“id”:1,“orgId”:1,“name”:“openhab_home”,“type”:“influxdb”,“typeLogoUrl”:"",“access”:“proxy”,“url”:“http://localhost:8086”,“password”:“xxxx”,“user”:"",“database”:“openhab_db”,“basicAuth”:true,“basicAuthUser”:"",“basicAuthPassword”:“xxxxx”,“withCredentials”:false,“isDefault”:false,“secureJsonFields”:{},“version”:1,“readOnly”:false},“id”:1,“message”:“Datasource added”,“name”:“openhab_home”}Adding openHAB dashboard tile for Grafana… 2018-12-25_23:00:33_EET [openHABian] Adding an openHAB dashboard tile for ‘grafana’… OK
Adding install InfluxDB with database configuration to OpenHAB
$ touch /etc/openhab2/services/influxdb.cfg
2018-12-25_23:01:55_EET [openHABian] Checking for default openHABian username:password combination… FAILED
2018-12-25_23:01:56_EET [openHABian] We hope you got what you came for! See you again soon :wink:

after a reboot i see a new UI in my OPENHAB

and now i can indeed enter the influx command.
Well so far that went quite a lot easier than i was reading in the forum. Should we add this into some of the basics of the openhab help pages??
I can contribute…

next place where i get stuck.

now when doing the “easy way” of using the Openhabian-config file, i have no idea where to continue in the tutorial but i decided to follow from Connecting Grafana to InfluxDB

here it is told:
_Logged in to the Grafana dashboard, go to “Data Sources” and create a new source pointing to your InfluxDB database, providing the credentials you chose earlier. _

but the only thing i see is this:
Not any Data Sources possible.

After finding a small button on the lower left i can log in.
I decided to log in as admin. (not sure if this is wise?)

in data sources it shows openhab_home. Well that seems good i guess.
not sure where to continue now?

Hi! Yes loggin in as admin to grafana is correct.
Now you need to tell openhab where the database is and how often values should be written to the database.
This is configured in the files /etc/openhab2/services/influxdb.cfg and /etc/openhab2/persitence/influxdb.persist. Just have a look at the section

Connecting openHAB to InfluxDB

1 Like

You openHABmachine

next steps done:
in influxdb.cfg i wrote:

# The database URL, e.g. or .
# Defaults to:
# url=http(s)://<host>:<port>

# The name of the database user, e.g. openhab.
# Defaults to: openhab
# user=<user>

# The password of the database user.
# password=

# The name of the database, e.g. openhab.
# Defaults to: openhab

# db=<database>url=http://localhost:8086

# Enable authentication in the [http] section of the configuration file /etc/influxdb/influxdb.conf:

enabled = true  
bind-address = ":8086"      # change to a specific interface if needed 
auth-enabled = true         # will enforce authentication

in persistence i made a new file called influxdb.persist
but how do i know what items i need to add if i have them added in PaperUI and my items map is empty except the readme.txt file?

i went to PaperUI select items and if i want to have my node6 electricity meter i copy the name and paste it in Items like this?
Or something else?

this is what i have now made:

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
    everyMinute : "0 * * * * ?"
	everyHour   : "0 0 * * * ?"
	everyDay    : "0 0 0 * * ?"

	// if no strategy is specified for an item entry below, the default list will be used
	default = everyChange

 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
Items {
	// persist all items once a day and on every change and restore them from the db at startup
	* : strategy = everyChange, everyDay, restoreOnStartup
	// additionally, persist all temperature and weather values every hour
	//Temperature*, Weather* : strategy = everyHour

after a reboot, i see in the frontail:

2018-12-26 22:24:28.741 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'QueryablePersistenceService.query()' on 'org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate@ec1dd': Connection refused (Connection refused)

2018-12-26 22:24:30.048 [ERROR] [ence.internal.PersistenceManagerImpl] - Exception occurred while querying persistence service 'influxdb': Connection refused (Connection refused)

and a lot of

2018-12-26 22:24:34.998 [ERROR] [org.influxdb.impl.BatchProcessor    ] - Batch could not be sent. Data will be lost

2018-12-26 22:07:57.394 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'QueryablePersistenceService.query()' on 'org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate@15c7183': Connection refused (Connection refused)

retrofit.RetrofitError: Connection refused (Connection refused)

	at retrofit.RetrofitError.networkError( ~[?:?]

	at retrofit.RestAdapter$RestHandler.invokeRequest( ~[?:?]

	at retrofit.RestAdapter$RestHandler.invoke( ~[?:?]

	at org.influxdb.impl.$Proxy127.query(Unknown Source) ~[?:?]

	at org.influxdb.impl.InfluxDBImpl.query( ~[?:?]

	at org.openhab.persistence.influxdb.internal.InfluxDBPersistenceService.query( ~[?:?]

	at org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate.query( ~[?:?]

	at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:?]

	at java.lang.reflect.Method.invoke( ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect( [102:org.eclipse.smarthome.core:0.10.0.oh240]

	at [102:org.eclipse.smarthome.core:0.10.0.oh240]

	at [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:?]

	at java.util.concurrent.ThreadPoolExecutor$ [?:?]

	at [?:?]

Caused by: Connection refused (Connection refused)

	at Method) ~[?:?]

	at ~[?:?]

	at ~[?:?]

	at ~[?:?]

	at ~[?:?]

	at ~[?:?]

	at com.squareup.okhttp.internal.Platform.connectSocket( ~[?:?]

	at com.squareup.okhttp.internal.http.SocketConnector.connectRawSocket( ~[?:?]

	at com.squareup.okhttp.internal.http.SocketConnector.connectCleartext( ~[?:?]

	at com.squareup.okhttp.Connection.connect( ~[?:?]

	at com.squareup.okhttp.Connection.connectAndSetOwner( ~[?:?]

	at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner( ~[?:?]

	at com.squareup.okhttp.internal.http.HttpEngine.nextConnection( ~[?:?]

	at com.squareup.okhttp.internal.http.HttpEngine.connect( ~[?:?]

	at com.squareup.okhttp.internal.http.HttpEngine.sendRequest( ~[?:?]

	at com.squareup.okhttp.Call.getResponse( ~[?:?]

	at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed( ~[?:?]

	at com.squareup.okhttp.Call.getResponseWithInterceptorChain( ~[?:?]

	at com.squareup.okhttp.Call.execute( ~[?:?]

	at retrofit.client.OkClient.execute( ~[?:?]

	at retrofit.RestAdapter$RestHandler.invokeRequest( ~[?:?]

	... 14 more

this repeats all over.

and i also get a page not available when i go to

Any idea what i did not do correct? Thanks again.

Have you set the correct password and user name in your configuration file? Seems like it rejects you beacause of wrong or missing credentials…

1 Like

Dear Bob,

Thank you for all your help.
I finely managed to get it to work with following this tutorial.

I would recommend others to follow the same,

Thank you @BobMiles and @jimmyalias who helped me a lot!

main issues for me were

  • my modem separated LAN and WIFI for some reason. Now everything is on WIFI including the RPI3
  • 1 faulty SD card (created some really annoying feature that my changes were not done after a reboot
  • lack of knowledge about programming, but with visual studio code, even i can do it :slight_smile:
  • some sources on the internet are outdated and as this might be obvious for others… Me as a beginner has problems in seeing the differences.
  • too hasty willing to get the best results.

I hope i can start to contribute soon, instead of being a pain.


A lot of time spend there, like me! I did in parallel what you did and find that the script in the openhabian-config to install InfluxDB and Grafana, was not correct for me, as it didn’t created the db due to autorisations problems… I gave my solution there
I appreciate the citation I’ve found in the openHabian documentation:
A home automation enthusiast doesn’t have to be a Linux enthusiast!
and I appreciate all the work that has been done to help beginners, But sometimes it’s very difficult trying to find the right updated info in the right place.

But after some testing, still have autorizations problems:

    2019-06-12 10:22:30.731 [ERROR] [.internal.InfluxDBPersistenceService] - database connection error Connection refused (Connection refused)
    2019-06-12 10:22:30.736 [ERROR] [.internal.InfluxDBPersistenceService] - database connection does not work for now, will retry to use the database.

This is my influxdb config:


Ok again, answering myself, doesn’t support IP, have to remplace with localhost:


1 Like