Hello,
I have written a rule that is based on some astro-binding items (azimuth, elevation). The set point values of these items can be controlled via my sitemap. In order to having a defined state for these values after a restart of OpenHAB I have persisted the values with InfluxDB. My problem is that InfluxDB returns the values with a decimal point, e.g. “70.0” instead of only the value “70”. The result is that the rule is not working after a restart of OpenHAB until I have newly “clicked” and thus correctly “reactivated” the set point again in the sitemap. How can I solve the problem? Of course I could use fixed values for the items directly in the rule but that is not the solution I prefer because I would loose the comfort and flexibility the sitemap solution offers to me.
I would be happy if someone could give me a hint how to overcome that problem.
If you only want to persist values for a restart, you could switch to MapDB.
I think that would be the best solution. If you don’t want to draw charts over a time, InfluxDB is a bit of overkill:
Thanks for the hint. I want to further use InfluxDB for charting (as I already do from the past). Do you know whether it is possible to use MapDB and InfluxDB in parallel without conflicts?
I can continue to use my existing InfluxDB persistence?
I can easyly install and use MapDB in parallel?
I have to designate the items I want to persist in MapDB within the mapdb.persist file? and
can keep the items I want to further persist in InfluxDB unchanged in my influxdb.persist file?
when I did the above things do I have to set MapDB as new default persistence or can I leave InfluxDB as default persistence like before and the things will work properly by individual designation of items in the two *.persist files only?
So each Item which should be only peristed for keeping the old value after reboot is put into the group gRestoreOnStartup and thus it will automatically use MapDB
All other items whose values should be persisted over a longer time are put into the group gPersistence
Perfect, Thanks for your help. Am I right, that it is not strictly necessary to do it by groups only but it would also be possible to use the individual items in the both *.persist files?
Thank you very much for your help. I will consider the group approach too as the number of my items is also growing.
BTW: Do you know how to check whether the MapDB persistence works correctly? Is it possibe to see / check the stored value anyhow / anywhere?
Please be aware that you have to use the name of the persistence service if querying a persistence service from a rule other than the default persistence service: mapdb as default:
// query from mapdb:
myPersistedItem.previousState(true).state
// query from influxdb:
myPersistedItem.previousState(true,"influxdb").state
This is a not working example, as mapdb is not able to answer the query correctly, but you get the point anyway…