Show graphs in OpenHAB

Some graphs, showing how different items change in function of the time, are pre-configred in the SD card supplied.

Using the Grafana dashboard manager at cm3-home.local:3000 the way the graph is displayed can be modified changing time period, refresh, item to show, math functions to apply and many other more:

How to plot graphs on a Habpanel

OpenHAB items can automatically be stored in the time series database InfluxDB. Grafana ships with very feature rich data source plugin for InfluxDB. Supporting a feature rich query editor, annotation and templating queries. For these reasons their installation scripts are included in the standard Openhabian distribution.

Both Grafana and InfluxDB can be easily installed using openhabian-config tool

  • 20 | Optional Components Choose from a set of optional software components
    • 24 | InfluxDB+Grafana A powerful persistence and graphing solution

After adding DB and graphs components, the persistance service can be installed.

persistence-influxdb - 1.10.0

This is the link between OpenHAB items and InfluxDB.

Then create the table and set the InfluxDB permissions

[email protected]:~$ influx
Connected to http://localhost:8086 version 1.5.0
InfluxDB shell version: 1.5.0
> CREATE DATABASE openhab_db
> CREATE USER openhab WITH PASSWORD 'openhab'
> CREATE USER grafana WITH PASSWORD 'grafana'
> GRANT ALL ON openhab_db TO openhab
> GRANT READ ON openhab_db TO grafana
> exit

Enable the authentication in the HTTP section

sudo nano /etc/influxdb/influxdb.conf

# Determines whether HTTP endpoint is enabled.
enabled = true

# The bind address used by the HTTP service.
bind-address = ":8086"

# Determines whether user authentication is enabled over HTTP/HTTPS.
auth-enabled = true

Restart InfluxDB service


sudo systemctl restart influxdb.service


Grafana panel is accessible at address: cm3-home.local:3000
with default login admin:admin

Disable registration and enable anonymous users to access Grafana

sudo nano /etc/grafana/grafana.ini
# disable user signup / registration
allow_sign_up = false
# enable anonymous access
enabled = true

Link Grafana with InfuxDB

using the already defined accesses:


Link OpenHab with InfluxDB

Edit the services/influxdb.cfg file

Add the following lines:

# The database URL, e.g. or .
# Defaults to:

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

# The password of the database user.

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

# The retention policy to be used, needs to configured in InfluxDB
# Till v0.13: 'default', since v1.0: 'autogen'


Configure the item to be stored in InfluxDB and the update strategies
Edit the persistence/influxdb.persist file 

everyMinute : "0 * * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"

default = everyChange

L1P, L1V, L1C, L1F : strategy = everyMinute, everyChange, restoreOnStartup
Sonoff1Temp, Sonoff1Hum, Netatmo_Indoor_Co2, TempIntValue, Netatmo_Indoor_Humidity, Netatmo_Indoor_Temperature, Netatmo_Outdoor_Temperature, Netatmo_Outdoor_Humidity, Netatmo_Indoor_Pressure : strategy = everyMinute, everyChange, restoreOnStartup
SpeedtestResultPing, SpeedtestResultDown, SpeedtestResultUp : strategy = everyChange
Add the item to plot

Many different graphs can be created adding new dashboards and configuring stored items to plot

Using the sharing option it creates the link to be used in a frame widget to show the graph on the Habpanel