Item status and configuration change

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.

Yes. There are reasons, of course, about consistency of stuff you might have edited.

Bear in mind this is consequence of development - you shouldn’t be doing this every day once the system is to your satisfaction.

The persistence + restore-on-startup feature is about behaviour at system start. Not especially useful for in-flight editing.

Mostly you can design your rules etc. to deal gracefully with the situation.

If it is a terrible issue for you, it should be straightforward to construct a restore-on-demand feature,maybe for just a few key values.

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.

1 Like