@jaswalters wrote:
In other languages I would normally break the loop.
Since Jinja cannot break how do I only return the first match?
{% set inputerr = False %} {%- for state in states.input_text -%} {% if (( state.entity_id | regex_match('^input_text.lockcode_([0-9]|[12][0-9]|30)$')) and (state.state != 'unknown')) %} {% set slotusercode = state.state.split(':') -%} {% if slotusercode[1][0:4]|int() == states("input_text.lockcode_code")[0:4]|int() %} {% set inputerr = True %} {{inputerr}} {%- endif %} {%- endif %} {%- endfor %}
Posts: 1
Participants: 1