Hi,
guess I’m still a beginner even if I’m using openHAB since a few years.
What is a bit annoying to me everytime I reconfigure openHAB is that it loses the status of almost all items.
I know there is the persistence functionality but the biggest part of my items are just z-wave switches and introducing persistence for those I find a bit weird.
In any case adding or changing a single item in my item definitions seems to reset the state of everything (including values like temperatures). Typically that means to wait several hours up to a day until everything has a proper status again.
How is this typically solved?
Really saving everything into a persistent mapdb? Or are there other solutions?
I have started using mapdb with zwave items but cannot comment much beyond that. I have my items in many text files to minimize the impact of changing things. Only those Items in the edited file are affected.
I think I have seen it work when saving a bad file - all the Items are deleted. After correcting the error the Items seem to come back with their status persisted.
As has been indicated, restoreOnStartup using MapDB is the typical approach. You don’t have to do it for all your Items, just for those where it makes sense (e.g. those that report only once a day for example). See Design Pattern: Group Based Persistence for details.
I can’t say this definitively, but I believe this behavior doesn’t exist for Items defined in JSONDB.
I believe, as with the System started Rule trigger, restoreOnStartup also runs when .items files are loaded and not just when OH starts.