Return to earlier state

I have a switch called SceneCleaning and when that is turned to on i switch on all lamps in group Cleaning.

What i want to do is when Scene Cleaning is set to OFF i want to return the state of all lamps in group Cleaning to what it was when I entered tthe Cleaning mode.

How do i do this?


Sounds like a job for a HashMap, used in rules to record the state of group members when Cleaning triggered ON, and re-instate them when OFF

I have not worked with Hash Maps can someone point me in the right direction.


Or, you could use 'associated items;

I will try to save the time in an item when i press the clean button and then when i press cleaning off restore the items to the historical value before i pressed the button.