You could show a count of the number of currently open windows and doors. So it’s 1 when ‘a’ is open, and changes to ‘2’ if ‘b’ is opened, and then back to 1 if ‘a’ is then closed. This would give you that count:
Yes it’s possible and it’s only a little more complex than what @michaelblight has already provided. The following assumes you have created a helper group called binary_sensor.kitchen_window_group.
template:
- sensor:
- name: Open Kitchen Windows
availability: "{{ has_value(`binary_sensor.kitchen_window_group`) }}"
state: >
{{ state_attr(`binary_sensor.kitchen_window_group`, 'entity_id')
| select('is_state', 'on') | list | count }} open
attributes:
open_windows: >
{{ expand(state_attr(`binary_sensor.kitchen_window_group`, 'entity_id')
| select('is_state', 'on') | list) | map(attribute='name') | list | default("None", 1)}}
You can use the expand filter to access the whole state object of your cover entities, then select by the attribute using comparisons. The template to just list the selected entities’ IDs would be: