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

Two conditions in one condition - tricky part

$
0
0

@km4lin wrote:

Hello,
from a few hours I’m trying to make the conditions which allows me to do this:
if trigger.from state and trigger.to_state doesnt’ have a word ‘ONLINE’ in state then it’s true

or the other way:
if trigger.from_state is ‘ONLINE’ and trigger.to_state is ‘BOOST ONLINE’ than it’s false
else if trigger.from_state is ‘BOOST ONLINE’ and trigger.to_state is ‘ONLINE’ than it’s false
else is true
for example:

         - condition: template
            value_template: >-
              {% if states('trigger.from_state') != "ONLINE" and states('trigger.to_state') != "BOOST ONLINE" %}
                true
              {% elif states('trigger.to_state') != "ONLINE" and states('trigger.from_state') != "BOOST ONLINE" %}
                true
              {% else %}
                false
              {% endif %}

but it doesn’t work as expected. Where I’m wrong?
Please help :frowning:

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95394

Trending Articles



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