If I build a sequence of ifs and thens etc in an automation, where the initial trigger is an entity going from any state to a specific state, how can I make it so at the end of the automation the device goes back to what it was doing when the automation started?
Basically the "to be automated" device has 4 interlocked relays and one of the four is on at any given time. I want the automation to start based on a different device (the vacuum robot) showing a specific combination of entity states, which makes the target device do a specific thing by triggering a specific relay (which turns off whichever relay was on before due to interlock). But after a set of conditions that determine that the automation is no longer needed, I want the last step to be the automation turning on the relay that was on when the automation started, whatever that might have been.
What can I do to achieve this sort of memory effect? And please don't tell me the only way is to create four automation-paths per device to account for four possible start-states π
I have 8 of these devices around the house and also a full-time job π