Hi
So i have 12 thermostats and i want to make a small badge showing how many climate entitys that are actually heating, for this i can use hvac_action: heating when its not heating, the hvac_action: idle
For motion sensors i have previously did this like this
number_of_motion_sensors_on:
friendly_name: "Number of Motion Sensors On"
icon_template: mdi:run
value_template: >-
{% set count = namespace(value=0) %}
{% for entity_id in state_attr('binary_sensor.all_motion_sensors','entity_id') %}
{% if (states(entity_id) == 'on') %}
{% set count.value = count.value + 1 %}
{% endif %}
{% endfor %}
{{ count.value }}
This gives me almost what i want, but it using the state on climate, since this only have heat available it gets wrong
{{ states.climate | selectattr('state', 'eq', 'heat') | list | length }}