In my influxdb.persistence I have (among others) line:
gActivityPersist* : strategy = everyChange, everyDay, restoreOnStartup
restoreOnStartup does not work, meaning on openhab restart, items belonging to gActivityPersist group still have NULL value.
The moment I added persistence lines per every item (not group), item state was restored (even without openhab restart, as they had NULL value since the previous restart):
counterGamingHours : strategy = everyChange, everyDay, restoreOnStartup
Just to be sure,
- I removed per-item persistence lines, and restarted openhab: result NULL, not restored.
- I added per-item persistence lines, (values immediately popped up, and persistence.influx debuglog showed queries), restarted to be sure openhab: result values restored.
- I removed everything, restarted openhab, then added only group line: result NULL, not restored, AND contrary to the case no 2, there were NO queries to influxdb shown in persisdence.influx debuglog on update of influxdb.persistence. I suppose bug here in GROUPNAME* handling in persitence definition file.
here is item definition I use:
Number counterGamingHours "Licznik Godzin Grania [%d]" (gActivityPersist,gPlugHackerspaceGamingPC)
Did you allow or make sure everything in the group had time to receive a update before restarting OH and checking the persist?
Works for me, using groupname*
That’s using MapDB but I wouldn’t expect much difference.
Have you looked to see if data is actually persisted? You can use REST API to quickly check for records.
And … there is actually a Group Item defined as well?
Yes, quite a lot.
ALso I checked completly other items (single ones, not in group) that they have restored value upon quering group ones.
Also I waited 5 minutes past influxdb persistence info from openhab.log
But please see what I wrote about difference (ad 3 vs ad 2) in behaviour about modyfing influxdb.persistence file while openhab is running. It instantly issues influxdb queries for NULL items, if I add one-item-per-line entries in influxdb.persistence, while it does not issue influxdb queries if I add group definition to influxdb.persistence.
It does not work for me using InfluxDB.
Yes, there is data in /rest/persistence/items/xxx?serviceId=influxdb
There is no data (NULL) in current state /rest/items/xxx as it was not restored.
And thats a good question - need to check it.
There will be now, having used the individual Item persist strategy.
You’d have to look closely now to see if data is/was stored when you relied on groupname* strategy, I didn’t think of that.
If I put every item as individual entry of persisting strategy, it works. As I wrote in my OP.
It does not work if I use group* there with items only defined in group.
And org.openhab.persistence.influxdb log set to debug, shows NO operations from openhab to influxdb with the group* scenario.
Okay, so it is a persistence strategy problem, not restore of itself.
Is the group Item defined? Does it have members? You can verify by looking at the group Item with REST API
And we have a winner.
I had gActivityPersist group defined with a typo, meaning as it was not defined.
In case you use non-existing name in influxdb.persist file, openhab does not log any errors, and of course any persistence strategey is not working.
Thank you for help @rossko57!