In an automation, I can’t get:
{% if "{{states('input_number.propane_left')|float(0) < 20}}" %} red {% else %} black {% endif %}
to listen to changes in the input_number
Please help!
In an automation, I can’t get:
{% if "{{states('input_number.propane_left')|float(0) < 20}}" %} red {% else %} black {% endif %}
to listen to changes in the input_number
Please help!
That is just an if statement en like the dev tools says: it will not react to a change. You will need a trigger for that. (if any bit of code isnt working, throw it in the dev tools… )
Post the whole automation so we can see whats missing.
What tom_l said
Should be:
{% if states('input_number.propane_left')|float(0) < 20 %} red {% else %} black {% endif %}
If you’re interested, you can use an Immediate If (introduced in version 2022.2).
{{ iif(states('input_number.propane_left')|float(0) < 20, 'red', 'black') }}
Brilliant! Thank you!
Neat. Thanks!