The ability for an Automation to revert a device to a previous state

I’ve needed to do this several times and it requires quite a bit of boilerplate on the user’s behalf that is probably quite tricky for some and also creates clutter of the extra components needed. It is however very useful.

Basically I need to revert any state changes when an automation trigger… un-triggers.

So as an example, I want to change my AC’s mode when the door opens. When the door closes I want to revert the AC’s mode back to the mode it was in when the door was opened (i.e cool or heat). This required several automations and a helper to store the previous state.

I understand there is the ability to create dynamic scenes and restore to that but I believe that has similar end results (clutter and knowledge requirement)

Maybe this would required a new trigger type that’s restricted to triggerring on a binary sensor changing to true and the action is restricted to setting the state on an entity. The sensor changing to false would set the previous state stored during change to true

Thanks

Learning how to “restore scenes on the fly” is likely the only way you are going to be able to do this.