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

Markdown Card For Loop

$
0
0

@venture wrote:

I’m having a problem getting the length of a loop to show one time. I’m guessing it’s a syntax issue. Here’s my code:

{% for l in config.entities %}
  {% if ("state.l.entity", 'on') %} 
    Lights on: {{ loop.length }}
  {% endif %}
{% endfor %}

{% for l in config.entities if ("state.l.entity", 'on') %}
  {{ l.name }}
{%- endfor %}

38 PM

Why is the length repeating? Sorry, first time Python, and new to Home Assistant. I read the Jinja and Markdown Card docs and still can’t seem to figure it out. Thanks to anyone who can point me in the right direction.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>