Sensor with number of people in zone

I have seen some approaches here how to count people at home. I think timed polling is not systematic because entring/leaving zone is event so event-based update should be used. I also do not like that you have to define exact person in calculation if that person is at home.

Seems to me that community members are not able to define a sensor, that takes zone name as argument and has counter updated every time when any person defined in the HA enters or leaves a zone? Without manually updating sensor configuration it every time you add or delete a person in the configuration?

I understand that such sensor may need to by synced regularly, so yes, for that a timed event would be good. But once an hour, not every minute.

Thanks, Jan

Anyway, if the count of people in the zone should be used only to detect if at least one person is there, or all are out, then the goup integration can be used.