Hi
I would like to count the number of open windows. I have a group “group.skal” which contains all the sensors that I would like to count (on/off), which works the following way
- platform: template
sensors:
window_count:
friendly_name: "Open Windows"
entity_id:
- binary_sensor.openclose_12
- binary_sensor.openclose_16
- binary_sensor.openclose_20
- binary_sensor.openclose_3
- binary_sensor.openclose_2
- binary_sensor.openclose_5
- binary_sensor.openclose_4
- binary_sensor.stue_vindue
- binary_sensor.openclose_6
- binary_sensor.openclose_15
- binary_sensor.openclose_11
- binary_sensor.openclose_13
- binary_sensor.openclose_14
value_template: >-
{{ states | selectattr('entity_id','in',state_attr('group.skal','entity_id')) | selectattr('state','eq','on') | list | count }}
icon_template: >
{% if states.group.skal.state == 'off' %}
mdi:door-open
{% elif states.group.skal.state == 'on' %}
mdi:door-closed
{% else %}
mdi:help
{% endif %}
What doesn’t work is the icon. I would like it to be an open door or window if the group.skal is on and a closed door or window if it is off. Also it would be cool if the open part could be a yellow colored icon as the rest of Home Assistant