[SOLVED] Persistence with something like "changed to ON"?

Hey together,

is it possible to detail the persistence strategy with something like: persist only if item changed to ON?
e.g. I have a motion sensor and I would like to know when the last motion was triggered. I’m not interested in the opposite (changed to OFF). So I’m looking for a simple way to persist “everyChange or everyUpdate to ON”.

Is this possible with default persistence, or do I write my own rule? And if I need my own rule, is there a way to persist with a rule (e.g. to mySQL) or do I have to execute the command with executeCommandLine action?

Thank you very much!

Exclude the Item so it is not saved automatically in your .persist file. In a rule you can then use:


This will save the Item’s current state to persistence. If you need/want to save it to a different persistence from the default (e.g. save everything to mapdb but save these “changed to ON” events to mysql you can supply the name of the persistence you want to save it to:


Thank you @rlkoshak
I will do the persistence with these suggestion!