Hi
For learning/testing I created few ‘input_boolean’ helpers.
Assigned them to an area called ‘parter’.
I can create list of them using: area_entities(‘parter’)
I wanted to count those which are ‘on’ and came up with the following, not very elegant, ‘for’ loop:
{% set ns = namespace(count=0) %}
{% for temp in area_entities('parter') if is_state(temp, 'on') %}
{% set ns.count = ns.count + 1 %}
{% endfor %}
Total: {{ ns.count }}
I was hoping to find a magic filter for a pipeline like this:
{{area_entities('parter') | selectattr('state', 'eq', 'on') | list | count }}
(which doesn't work) and unfortunately couldn't find any.
Is there a nicer solution to count them?
Thanks
Chris