You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have the following template, which is working but with some issues i dont understnad/...
icon_color: |-
{% set grid_volt=states("sensor.grid_voltage") %}
{% if grid_volt>='90'%}
indigo
{% else %}
red
{% endif %}
When my grid supply is offline, my inverter system will typically report a value of "5.5v" if i cahnge the value in my template to "{% if grid_volt>='220'%}" even if the value coming out of the entity state is 5.5 the template is evaluted as true, and my icon will display as indigo.
from random testing, when the supply is off and the voltage is reported as ~5.5v, any input that starts with 1-5 (1,2,20,40 etc) will all evaluate as true and display indigo.
anything starting with 6 or greater (6,9,65,90 etc) will allow it to evaluate as fale and display as red.
im new to templates, and still muddling my way through it so if somone could help me understand why ot seems like only the first digit is being evaluated id greatly appreciate the help :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I have the following template, which is working but with some issues i dont understnad/...
icon_color: |-
{% set grid_volt=states("sensor.grid_voltage") %}
{% if grid_volt>='90'%}
indigo
{% else %}
red
{% endif %}
When my grid supply is offline, my inverter system will typically report a value of "5.5v" if i cahnge the value in my template to "{% if grid_volt>='220'%}" even if the value coming out of the entity state is 5.5 the template is evaluted as true, and my icon will display as indigo.
from random testing, when the supply is off and the voltage is reported as ~5.5v, any input that starts with 1-5 (1,2,20,40 etc) will all evaluate as true and display indigo.
anything starting with 6 or greater (6,9,65,90 etc) will allow it to evaluate as fale and display as red.
im new to templates, and still muddling my way through it so if somone could help me understand why ot seems like only the first digit is being evaluated id greatly appreciate the help :)
Beta Was this translation helpful? Give feedback.
All reactions