Remember items states?

Every time I modify my sitemap everything appears to forget it’s state - anything that uses a background process to update itself is obviously quickly corrected (plex /hue/nest for example), but things that use contact sensors are only corrected when the door is opened/closed.

I’m using persistence so I sort of expected this to happen automatically, but I guess it doesn’t so is there a script I can use that will pull the last value and update everything not updated? I think an item has a .previousState() I could use.

HI,

you have to configure a “restoreonstartup” in your persistance.

Example:

Items {
// persist all items once a day and on every change and restore them from the db at startup
* : strategy = everyChange, everyDay, restoreOnStartup
}

My persistence is setup as follows:

Strategies {
    default = everyChange
}

Items {
    * : strategy = default, restoreOnStartup
}

So I’m guessing it probably should be working?

I had a similar persist file and noticed it wasn’t doing the restoreOnStartup like I expected. When I ran it through the designer it underlined the default in the Items section in red. Once I changed that to everyChange it worked again.

Odd mine doesn’t - I’m still using 1.7 version of the designer though.

It does highlight everyDay however!