TIL: How to store and restore the state of multiple entities in Home Assistant

3 minute read Published:

Short howto: store/restore state in HA
The problem: Automations sometimes need to store the state of several entities at once and then restore all of them at a later point in time. An example of this is: When I open my balcony door at night, I want the lights in my room to turn off. when I close the balcony door, I want the lights to be restored to the exact same state they were previously.