Snapshot and restore multiple states


I’m planning to do the following:
I have about 10 Lights in Home Assistant. When I leave my house (I’m already using presence-detection) I want to turn all lights off but remember the states (color, brightness…). When I arrive again, all the lights that were turned off (not all lights!) automatically should turn on again. Is there something like a snapshot feature or a simple workaround?

Thank you in advance

You could create an input boolean for each light and set the state of each one when you leave in an automation. Then when you get back, you could set the state of the light based off the inputs.

For example, if you have a light called living_room then you would create an input boolean called living_room_bool. You would create an automation for when you leave home to set the living_room_bool to the state of living_room. When you arrive home you would set the state of living_room to the state of living_room_bool.

Thank you! That’s really not a bad idea :sunglasses:

Depending on the kind of light you’re using, you might have to create some additional input_number ‘variables’ to store brightness, RGB Value, etc.

If your lights turn on with the same values that they had before they were switched off, it’s not necessary.
But if there is a ‘standard’ state the lights go into when simply switched on you might have to use this.

FWIW, see what I did here:

1 Like

Oh wow - thank you very much! This seems great!

Believe it or not - I’m using Hass for over a year now and never read about this scripting-functionality. :see_no_evil:

Your script seems to do exactly what I need :grinning:

1 Like