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

Is_state in templating

$
0
0

Hi there, I wonder why the is_state function used in the for loop is not correct.

{{ is_state('light.wohnzimmer_kronleuchter', 'on') }} returns what I expected as a result: True

I was testing if I can do that while iterating over the state objects. Unfortunately I do not understand the result:

{% for state in states.light %}
  {{ state.entity_id }}
  {{ state.state }}
  {{ is_state(state.state, 'on') }}
{%- endfor %}

displays the following amongst others

...
  light.wohnzimmer_kronleuchter
  on
  False
...

I wonder why the statement in the for loop is_state(state.state, 'on') is False in this case. I was hoping for True.

I appreciate your help in teaching me to understand this. Thank you all.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 108325

Trending Articles



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