Automation to turn on entities only if they were on before

I have some grow lights that I would like to turn off during peak electricity times. No issue to turn everything off in a single automation. But I have frequent situations when things are being worked on and should remain off, so I need to figure out a way of NOT turning on anything that was off already, before the “all off” automation. If my black out window is 4 hours, then I suppose I could do a check to make sure that an entity has NOT been in an off state for more than 4 hours, correct? I’m not sure how to do this without creating a sperate automation for 12 different devices.

maybe take a look at scenes.

you could create a scene that snapshots the state of the lights before you turn them off. then restore the scene later when you wish.

does that do what you want?