Somewhere along the way RRD4J became the default persistence and I believe the default setting is also for restore on startup (One of the forum experts can verify). The only issue is that it only deals with numbers and (ON/OFF) IIRC. Therefore, also added mapdb and put datetimes and images to restore on startup. So i’m mostly using RRD4J and only MapDB for a handful of items.
As far as I know rrd4j only does numbers.
I persist using rrd4j so the graphs work and I add the items in the configuration.
I used to just persist everything in openHab 3 with no special settings and it used to work.
Now I have to add all the items I wish to restore on startup.
I just wanted to know if there is a way to persist everything in mapdb without having to add all the items.
I used to be DSL and files but have swapped totally to UI and javascript and don’t use sitemap at all anymore.
It is a bit easier and less prone to errors.
Thanks for that.
The examples on the documentation look like file examples but I have another openHab test system so I put the configuration in the persistence file and then went to the UI and copied the code to the real system and also turned on mapdb debug and it works.
It may do a lot more disk writes as it is storing everything so I may go back to just inclusing the items I want to restore. At least I know there is a way to do all items.
I don’t think you can do that. The closest thing would probably be to create a group for all string items and persist all members of this group. Of course this is not really ideal as you would need to remember to always add new items to this group.
Can I suggest just storing every item in mapdb? It is not taking a lot of space at is only 2 values for each item (current and previous). And restoreOnStartup will work from mapdb for all item. I would switch off restoreOnStartup for all other services, and use mapDB just for that.
Right, so have a configurattion just using “*” for resotreOnStartup using MapDB and a similar one for RRD4J for everything else? I guess I could try that, thanks!
@Mherwege has the best solution here but I wanted to add some details and an idea which might be useful to someone someday who comes across this thread.
That’s because that means all members of the Group String which of course is impossible because you cannot name a Group “String”.
You could create a Rule to add/remove the members to the Group at runtime. However, restoreOnStartup usually happens before the rules engine starts so it might not work flawlessly for new Items. One would have to experiment to find out. Also, the Items would need to be managed, not .items file based.
In JS the script action would look something like:
The first line gets an array of all the Items of type String that are not already members of the AllStrings Group. The second line adds them to the AllStrings Group.
Again, I’m not sure this would be all that useful for persistence because of the order of booting. Maybe if you always remember to run it after adding an Item or configure it to run periodically automatically.
But dynamically setting Group memberships can be useful in a lot of other ways.