This is an automated archive made by the Lemmit Bot.

The original was posted on /r/homeassistant by /u/TomerHorowitz on 2024-11-04 22:52:51+00:00.


Is there an elegant way to save the states of my devices before an automation changes them, so I could later reload them back into their pre-automation state once the inverse-automation (the automation that reverses the actions that the original automation made) is executed?

I’ll give an example: I live in Israel and I have rocket alarms from time to time, and sometimes they get me in unfortunate times where I don’t hear them (i.e. when I’m wearing headphones, etc).

So I created an automation that once a rocket alarm starts in my area, all my house lights turns red, and all the blinds are set to close.

Now, what I want is to create an inverse automation that once the alarm has ended, it will return all the devices that the previous automation changed into their exact original state.

Does home assistant have an elegant way to do this?

Ideally I imagine a “Save States Snapshot” event where you provide devices, entities, etc, and a name for the snapshot in the first automation (before the changes)

Then a “Load States Snapshot” event where you only provide the name (specified in the save event) and it’ll populate states back into their targets.

What are the chances this sort of elegant solution exists in home assistant (in one way or another)?