--- - platform: template sensors: number_doors_open: friendly_name: "Open Doors" unit_of_measurement: door(s) value_template: > {{ label_entities(label_id('external')) | expand | selectattr('state', '==', 'on') | map(attribute='entity_id') | select('in', label_entities("door")) | list | count }} # {{ states.binary_sensor | selectattr('object_id', 'match', 'door_.*') | selectattr('state', '==', 'on') | map(attribute='entity_id') | list | count }}