group:
  all_doors:
    name: All doors
    entities:
      - binary_sensor.front_door_contact
      - binary_sensor.bedroom_door_contact
      - binary_sensor.kitchen_door

sensor:
  - platform: template
    sensors:
      open_door_count:
        friendly_name: Open door count
        value_template: >-
          {% set entityStates = states | selectattr('entity_id', 'in', state_attr('group.all_doors', 'entity_id')) %}
          {{ entityStates | selectattr('state', 'eq', 'on') | list | count | int }}

homeassistant:
  customize:
    binary_sensor.front_door_contact:
      friendly_name: Front door
    binary_sensor.kitchen_door_contact:
      friendly_name: Kitchen door
