Hi all,
i want to store some Key/Value pairs out from my rules. Actually i do this in HashMaps in variables, but this isn’t persistent.
In some cases (e.g. on starting having a bath) i want to store the position of the Rollershutter, and when i’m finishing in bath, the Rollershutter should return to the old position before bathing.
I use MapDB-Persistence, and can persist the state on starting, but on finishing i don’t know the timestamp, when it was persisted.
And in other cases the Key is variable and not Item-Based…
So, is there a (simple) chance to store flexible Key/Values in a Redis-Cache or other DB?
Or is my actual solution to use HashMaps the best one?
If you are using rule variables, you should be using the storeStates and restoreStates Actions instead of writing the code to pull and restore the Item’s states yourself.
Awesome! Learnt something new (as always!). I have recently started using item metadata to store some states rather than using a global variable. One thing I stored was the “direction” of light dimmer - whether it is curently getting brighter, or dimmer, when a button “hold” is received.