I wrote an automation that turns a lamp in my living room on and sets its color to red if a gate to my backyard is left open for more than 30 seconds.
When the gate closes I want to set the lamp back to its original state before the automation was triggered. How do I save the on or off state at the start and restore it later?
If I posted this in the wrong place, please let me know where it should have gone. TIA
You can use the scene.create service to save the light’s state. Here is an example using this technique with a climate device. Post your automation and we can point you in the direction of how to set it up for your devices and situation.