I want a notification if some lights, devices, … are on when nobody is home.
An automation fires when any trigger becomes true. So a trigger per person that leaves is not an option.
The zone entity state is the number of people in the zone. This is a good way to trigger an automation when everybody has left.
In yaml this looks like:
platform: state
entity_id:
- zone.home
to: "0"