Combine State of Several Sensors

I am trying to create a helper that tells the number of people home. I wanted to do this by adding zone.home plus a second entity that tells me how many visitors are connected to the guest wifi.

When I try to create a helper for Combine State of Several Sensors, I get this message: Entity zone.home belongs to domain zone, expected [‘sensor’, ‘number’, ‘input_number’] @ data[‘entity_ids’][0]

Is there some way around this?

I’m trying to get the true number of humans in my home, rather than just the number of HA users. E.g. if I leave for a short errand but a guest stays home, I don’t want things to start turning themselves off.

Because the entities are from different domains, you will need to set it up as a Template sensor which can be done in the same Helpers menu.

In the State template field place the following:

{{['zone.home', 'sensor.YOUR_GUEST_COUNT_SENSOR']
| map('states') | map('int', 0) | sum }}

If you don’t actually need a running count of the household population, you could set it up as a Template Binary Sensor instead, converting the template to a true/false expression like:

{{ ['zone.home', 'sensor.YOUR_GUEST_COUNT_SENSOR']
| map('states') | map('int', 0) | sum > 0 }}
3 Likes

Thank you @Didgeridrew ! That worked. Seems so obvious in hindsight.