I’ve seen the several threads on the same topic, but they didn’t help me.
Ubuntu 20.04, OpenHab 2.5.9
I followed the InfluxDB+Grafana persistence and graphing.
I was able to use the sine.py sample to get some data into InfluxDB and visualize it in Grafana.
$ ls -l /etc/openhab2/services
total 24
-rw-r--r-- 1 openhab openhab 2269 Aug 23 06:45 addons.cfg
-rw-r--r-- 1 openhab openhab 618 Dec 28 13:31 influxdb.cfg
-rw-r--r-- 1 openhab openhab 335 Dec 28 13:55 influxdb.persist
I started with userid openhab in InfluxDB, but then reverted to the admin account, as I saw others having a problem with permissions in InfluxDB (note that my sine.py is able to pump data):
$ cat /etc/openhab2/services/influxdb.cfg
url=http://192.168.0.3:8086
#user=openhab
user=admin
#password=<openhab-password>
password=<admin-password>
db=openhab_db
retentionPolicy=autogen
$ cat /etc/openhab2/services/influxdb.persist
Strategies {
everyMinute : "0 * * * * ?"
everyHour : "0 0 * * * ?"
everyDay : "0 0 0 * * ?"
default : everyChange
}
Items {
EnergyMeter_kwh : strategy = everyChange
Ws2902a_Temperature : strategy = everyChange
Laptop_power : strategy = everyChange, everyMinute
}
In influx:
> settings
Setting Value
-------- --------
URL http://localhost:8086
Username admin
Database openhab_db
RetentionPolicy
Pretty false
Format column
Write Consistency all
Chunked true
Chunk Size 0
> show series
key
---
sine_wave
I’ve increased logging levels:
openhab> log:list | grep persistence
org.openhab.persistence.influxdb | TRACE
org.openhab.persistence.mapdb | DEBUG
Restarted the entire OpenHhab service and also the InfluxDB bundle.
grep -i influxdb /var/log/openhab2/openhab.log:
2020-12-28 14:03:06.398 [DEBUG] [.InfluxDBPersistenceServiceActivator] - InfluxDB persistence bundle has been started.
2020-12-28 14:03:06.408 [DEBUG] [.internal.InfluxDBPersistenceService] - influxdb persistence service activated
2020-12-28 14:03:06.420 [DEBUG] [.internal.InfluxDBPersistenceService] - database status is OK, version is 1.8.3
This may be meaningful: I do NOT see this line in the openhab.log, as I have seen on other threads on the problem of OpenHab not pumping data into InfluxDB, for instance:
15:51:21.179 [DEBUG] [org.openhab.persistence.influxdb ] - ServiceEvent REGISTERED - {org.openhab.core.persistence.PersistenceService, org.openhab.core.persistence.QueryablePersistenceService}={service.pid=org.openhab.influxdb, db
as if my influxdb bundle has not successfully registered to receive events?