Don't return light to snapshot state if light changed while script is running

Hello,

I have a script that creates a snapshot of a few lights, then changes the lights to blue for a few minutes and then restores the states of the lights. That works fine.

But I was looking if there’s a way that I could prevent the states from being restored if I turned off the light while the script was running.

For example, the light is on white, then the script is activated, snapshots the state, then turns the lights blue, but if I turn off the light while the light is blue (let’s say to go to sleep). Now I would want that light to remain off instead of being restored

Does anyone have any ideas? Thanks!

Turn off the script that’s going to restore it

Scenes are all or nothing, you can’t partially execute a scene. You could make a whole bunch of tiny scenes I guess, one per light. Then conditionally restore each one. Or as petro says, stop the whole thing from restoring if something changed which makes it unrestorable.

I didn’t mention that other actions are running during the script and it’s more than one light. So if I stop the script, the other lights, which I want to return would remain blue.

Separate the scene restore into its own script and turn it off