Hi,
I’ve setup influxdb persistence service following the tutorial. The connection with Influxdb is working. When I login on the influx database, show databases shows openhab_db and show measurements shows me the names of the items created by openhab. However, there are no time stamps and values; select * from itemname is empty for all items. So, I must be missing something in my setup.
I’m running Openhab 2.5.6-debian and influxdb (1.8.7) both as a docker image. Also I’ve a python script running in another docker that is posting weather observations to influxdb and that is all OK. I can visualize that data in grafana without problems. The python script uses the same credentials to set up the connection to influxdb as openhab.
Any ideas where I go wrong?
influxdb.persist
// persistence strategies have a name and definition and are referred to in the “Items” section
Strategies {
every5Minutes : “0 /5 * * * ?”
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
}
Items {
// state of following group of items will be restored on startup
// check for race conditions on startup
restoreOnStartupgroup* : strategy = everyChange, restoreOnStartup
// Smartmeter time series group
// Every 5 minutes state is stored in database, downsampling of data
// required at database level to limit datavolume!
sm_timeseriesgroup* : strategy = every5Minutes
// Infrastructure monitoring data
// Every update is stored in the database, downsampling of data
// required at database level to limit datavolume!
id_timeseriesgroup* : strategy = everyUpdate
// Climate data
// Every 5 minutes state is stored in database, downsampling of data
// required at database level to limit datavolume!
cd_timeseriesgroup* : strategy = every5Minutes
I had to check but yes there is an items file that defines the groups that are specified in the infuxdb.persist file. The group for the example items is
Group sm_timeseriesgroup “Smartmeter Timeseries Group” <“line.svg”>
The logs show loading of the persist file, and all things and items, without errors.
2020-08-20 19:34:47.892 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘lightcondition.items’
2020-08-20 19:34:48.021 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘homegroups.items’
2020-08-20 19:34:48.172 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘infrastructure.items’
2020-08-20 19:34:48.231 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘outdoorlightgroups.items’
2020-08-20 19:34:48.264 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘persistentgroups.items’
2020-08-20 19:34:48.351 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘weather.items’
2020-08-20 19:34:48.483 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘milight.items’
2020-08-20 19:34:48.507 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘livingroomlightgroups.items’
2020-08-20 19:34:48.515 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘alarmgroups.items’
2020-08-20 19:34:48.539 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘iotgroups.items’
2020-08-20 19:34:48.579 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘chimesgroup.items’
2020-08-20 19:34:48.612 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘smartmeter.items’
2020-08-20 19:34:48.835 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘influxdb.persist’
2020-08-20 19:34:49.150 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘home.sitemap’
2020-08-20 19:34:49.328 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘astro.things’
2020-08-20 19:34:49.372 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘smartmeter.things’
2020-08-20 19:34:49.443 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘weather.things’
2020-08-20 19:34:49.505 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘infrastructure.things’
2020-08-20 19:34:52.670 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘smartmeter.rules’
2020-08-20 19:34:53.131 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘frontdoor.rules’
2020-08-20 19:34:53.318 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘milight.rules’
2020-08-20 19:34:53.424 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘outdoorlight.rules’
2020-08-20 19:34:53.598 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘lightcondition.rules’
2020-08-20 19:34:53.785 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘bedroomlight.rules’
2020-08-20 19:34:53.837 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘network.rules’
2020-08-20 19:34:53.915 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘exhaustfan.rules’
2020-08-20 19:34:53.960 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘qosgroup.rules’
2020-08-20 19:34:54.023 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘kitchenlight.rules’
2020-08-20 19:34:54.258 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘garagedoor.rules’
2020-08-20 19:34:54.321 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘livingroomlight.rules’
Group sm_timeseriesgroup
Group id_timeseriesgroup
Group cd_timeseriesgroup
Number SM_Energy_Delivered_Tariff1 "Energy Delivered Tariff1 [%.3f kWh]" (sm_timeseriesgroup) {channel="mqtt:topic:smartmeter_data:energy_delivered_tariff1"}
I’m pretty sure that mqtt is not capable to use UoM Items.
@Udo_Hartmann
The thread Kim_Andersen was pointing to was about missing Group definitions and also rossko57 mentioned that in his reaction. I checked and the Groups were all defined see above.
The persistence is on selected sensors that write every 5 minutes their to Influxdb to generate a timeseries for graphs with grafana. These have UoM, which I just took of in the definitions in the items file and restarted Openhab. That did not make a difference. You’re correct in that it was merely decoration as Openhab did not really much with the UoM. Also I did not expect that taking UoM would help as I’ve persistence also on all actors everyChange so that I can restart and get same state back. Their behavior when it comes to persistence is identical, only the itemnames appear in Influxdb no values. In fact you see slowly appearing all itemnames from actors in Influxdb after they change state. @jswim788 Need to think about how to do that. I’m running in a docker and have some difficulties with interacting with the openhab engine. Can’t connect to Karaf e.g.
They are not persisting. They only thing I see when monitoring Influxdb (a clean openhab_db database) that on change the itemname is created in the openhab_db. There is no timestamp or itemstate stored.
So my conclusion was that openhab has sufficient privileges to write in the database and the everyChange does fire.
Kim I followed your advice and change my persist file. I moved all comments on top of the Strategies and Items section. I also combined the two identical strategy definitions. I can’t explain why but it works!, so I’m not complaining. I’ll mark yours as the “solution”.
// persistence strategies have a name and definition and are referred to in the “Items” section
// if no strategy is specified for an Item entry below, the default list will be used
Strategies {
every5Minutes : “0 0/5 * * * ?”
everyHour : “0 0 * * * ?”
everyDay : “0 0 0 * * ?”
default = everyChange
}
// restoreOnStartupgroup state of these items will be restored on startup
// check for race conditions on startup
// sm_timeseriesgroup* Smartmeter time series data
// id_timeseriesgroup* Infrastructure monitoring timeseries data
// cd_timeseriesgroup* Climate timeseries data
// For all timeseries data downsampling of data required at database
// level to limit datavolume!
Items {
restoreOnStartupgroup* : strategy = everyChange, restoreOnStartup
id_timeseriesgroup* : strategy = everyUpdate
sm_timeseriesgroup*, cd_timeseriesgroup* : strategy = every5Minutes
}