Hello!
I would like to do two if commands. Is this possible?
{% if is_state(‘climate.kuche’, ‘on’) %}
green
{% if is_state(‘input_boolean.kuche_boost’, ‘on’) %}
red
{% endif %}
{% else %}
grey
{% endif %}
Hello!
I would like to do two if commands. Is this possible?
{% if is_state(‘climate.kuche’, ‘on’) %}
green
{% if is_state(‘input_boolean.kuche_boost’, ‘on’) %}
red
{% endif %}
{% else %}
grey
{% endif %}
The way you have it, the “red” clause is dependent on the “green” clause, so the template will never just return “red”. The possible values are “green”, “green red”, and “grey”.
You need to use elif
if the clauses are mutually exclusive:
{% if is_state('climate.kuche', 'on') %}
green
{% elif is_state('input_boolean.kuche_boost', 'on') %}
red
{% else %}
grey
{% endif %}
Hello!
Thanks, it works great.