Adjust lights w/ an automation and then return back to previous or default state (color, power, etc)

I’m interested to learn how others would approach something like this. I want to be able to adjust the color and state (on/off) of various (or all) RGB light bulbs in use using automations. Then, return all bulbs/lights back to their previous state.

For example, if three lights are on and three are off, I’d like to turn them all on and set them to a specific color. When finished, to set colors back to where they were and turn the ones that were off back off.

Scenarios where this could be used.

  • Red Alert: When security system is triggered, turn on all lights and set to red (or flashing red). Then return everything to where it was once disabled or after so many seconds/minutes.
  • Motion Detection: When motion is detected on a camera or sensor, flash the lights and then return them to normal mode and power state.
  • Notification: When something happens, quickly flash lights a color and the return them back to where they were (color and power state).

Obviously, there are so many reasons why you’d want to play with your lights. I just haven’t because I don’t want to mess up their normal daily use, having to re-configure each bulb, switch, etc.

Bulbs I have to play with include Hue and Yeelight (I’m sure I might come across others at some point…or I might stick to those two brands).

1 Like

You might want to use an Input Helper (Configuration → Automations and Scenes → Helpers). You can set the value of the helper when the automation is triggered and then use the state of the helper to restore your other states to their original settings. Essentially, the input helper lets you save some information (in this case the state of another entity) for later use.

You probably want either an input number or input text depending on exactly what you’re storing.

1 Like

There’s an example in the docs on how to store a scene “on the fly” to save the state of your entities, do something, then restore the scene later.

https://www.home-assistant.io/integrations/scene/#creating-scenes-on-the-fly

3 Likes

Thanks! Using the snapshot ability, I have figured out how to implement it into automations. Now I can start finalizing the ideas I have. :slight_smile: