Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 103358

Counting simple variable in jinja (loop)

$
0
0

I am trying to create a simple loop where a variable is counted up. The variable is relevant for a later query.
Actually I would have the values 2, 4, 6… but I only get 2, 2, 2,…

Where is the error?

      value_template: >-
        {% set c = 0 %}
        {% for i in range(0,10) %}
          {% set c = c + 2 %}
          {{  c  }}
        {% endfor %}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 103358

Trending Articles