Closed ghulmarduk closed 1 year ago
Update: the absolute humidity in my cellar just went up to 10,2 g/m³ and the script outputs a "False" as intended.
This is happening because you're comparing the values as strings. This leads to "alphabetical" sorting, where 1 comes before 9. You can solve it by parsing the values properly, like so:
{% if states('sensor.keller_absolute_humidity') | float > states('sensor.aussen_absolute_humidity') | float %} true {% else %} false {% endif %}
Furthermore, you're essentially saying {% if true %}true{% else %}false{% endif %}
which is unnecessary. The following would suffice: {% states('sensor.keller_absolute_humidity') | float > states('sensor.aussen_absolute_humidity') | float %}
.
Thank you so much - i´ll try that out.
Edit: Works like a charm. Thanks a lot.
I don´t know if this is the fault of the integration or my script calling it´s values; if the value of "absolute humidity" reaches 10, it´s counted less than that (?).
e.g. at this moment the absolute humidity in my garden is 13,9 g/m³ and in my cellar 9,8 g/m³, but my script outputs a "True" though it should be a "False". When absolute humidity in my garden is below 10 everything works as intended.
this is the script:
{% if states('sensor.keller_absolute_humidity') > states('sensor.aussen_absolute_humidity') %} true {% else %} false {% endif %}
and this is the entry in my configuration.yaml: `thermal_comfort: