and then there is a binary sensor that will determine whether a circulation fan is turn on or off if the difference is greater than 1.5 degC.
circulation_fan:
friendly_name: "Circulation Fan"
value_template: >-
{% if states.sensor.e4_temperature_differential.state >= 1.5 %}
on
{% else %}
off
{% endif %}
However, when i check in the developer’s tools, i see that binary_sensor.circulation_fan is “unavailable”. And in the Template section, i see that the error is:
TypeError: '>=' not supported between instances of 'str' and 'float'
I figured that means the calculation where i do the subtraction is outputting a string and not a float, so i modified that line to say:
all the temperatures are there, even the evaluation of the temperature differential is there too.
It’s only the comparison of the temperature where it breaks …
It also makes adding additional sensors easier. You get this benefit as well:
Sensors with an unknown state will be ignored in the calculation. If the unit of measurement of the sensors differs, the min_max sensor will go to an error state where the value is UNKNOWN and unit of measurement is ERR.
thanks, i did try that and i seem to run into that problem a lot … but at least that didn’t resolve it this time around. also, yeah i did cut off the first part where the binary_sensor was located …
based on your explanation, my problem was converting from string to a float in the wrong spot? I tried to do it in the sensor thinking that it would stay as a float when i used it later in the binary_sensor. But instead, convert it wherever you plan to do the comparison is what should be done?
Thanks for also catching the on/off versus true/false and also pointing to warning as well.
You have to do it in the differential sensor so you can subtract one from the other. However once this state is calculated and you go to use it elsewhere it is a string. States are always strings. So you need to convert it again in your binary sensor template. Only attributes can have other types.
You’ll need to do something with that binary sensor in an automation, like turn on/off the fan or the power to an outlet controlling the fan, but i’ll leave that part to your imagination.
The last piece is what’s shown on the frontend which is using the uptime card to show the status of the circulation fan or outlet:
Thx alot , yes i had already copied it all, even tom_l’s commends … the overall “setup” and automation i’ve already figured out … but new to HA, yaml, py and very “rusty” in .js … actually tom_l is 1 of my top “teachers” in here, he just don’t know
Thnx again ( 1 less in a big pile of “todo” , well beside actually doit )