Save current state (upon leaving) and send notification to restore that stage upon arrival. Possible?

Title is pretty clean I think. I want to trigger an automation if all people left the zone. Then I want to collect the state’s of lights, plugs and hvacs. Turn them off.
Note: this is not a scene! Can be random lights and devices.
When someone comes back in the zone I want that person to receive a notification to restore that previous state (or ignore it).

Why? Sometimes the heating or cooling is on with some lights etc. You need to get an errand and when you come back you want it like it was. But if you are planning on leaving longer everything has turned off and saves energy.

That’s easy enough. The state of a zone is the number of people in it. So:

trigger:
  - platform: state
    entity_id: zone.my_zone
    to: 0
    not_from:
      - unknown
      - unavailable

This however is vague:

What is it then?

All entities?

That’s not going to be easy.

The entities that are on (in case of lights) and the setting of heating/cooling.

So it is a scene on the fly with all your lights and climate entities.

Yes. Sort of.

https://www.home-assistant.io/integrations/scene/#creating-scenes-on-the-fly

1 Like

If you want to collect the states to restore them later, then you do need a scene. You could try to save the state of only those entities that were on. But it might produce unexpected results for e.g. motion activated lights when you turn those back on a couple of hours later. What if you leave in the dark and return in bright sunlight? Or the other way around?

I just turn everything off when I leave, and pick a suitable scene when I return. I use on the fly scenes only for shorter periods of time. For instance in case of a fire alarm I turn on all the lights. If I mark it is safe, I restore the lights to what they were by activating the scene I captured before turning on the lights.