Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions.
For more information, refer to guideline 21 in the FAQ.
…I will do this directley, but let me ask one last question:
{% set total=0 %}
{% for entity in state_attr("scene.weihnachtsbeleuchtung_innen_ein", "entity_id") %}
{% if states(entity)=="on" %}
{% set total = total + 1 %}
{% endif %}
{% endfor %}
{{total}}
I am using this code in a makrdown card and the issue is, that the variable “total” is not calculated. Seems to be that it is only locally available within the “for-loop”. How can this be solved?
Thanks and have a nice day!