Saving and recalling current “state”

Curious if anyone can help me figure this out -

I’m using SmartTools for a rental house I have out in the desert in CA. It’s controlling SmartThings which controls the many lights throughout the house. I have a button which guests can click which I call “Dark Sky” which will turn off every light in the house so folks can step outside and see all the stars without any light pollution from the house. It works fine for shutting everything off - however when turning things back on it just turns every light in the house on, even those that were off before. It’s basically a very “dumb” on/off master button for all lights in the house - so even if a light is off when Dark Sky is pressed it will be turned on when pressed again.

I’d love be able to save the “state” of every light in the house before they turn off so lights that were off remain that way, and lights that were dim go back to the dimness they were set at.

Would love to know what might be the best way to accomplish this in the rules engine and how it could be set up as a virtual switch?

I’d create a rule that, when you tap it, sets a variable for every light that was on to on.
So you start with, if light is on, then set variable to on, turn light off.
If variable is on, turn light on, turn variable off.

In another rule, you can create a reset after a certain time, or at 4am or something, to reset all variables to off.