Hi All,
I was fighting to get this and searched everywhere and never found a good example. (This probably says a lot about my developing and searching abilities!) Here is an example of a template that I used to check to see if my temperature on my main_floor was lower than that of the upper floor.
platform: template
sensors:
fan_check:
value_template: '{% if states.sensor.upstairs_temperature.state > states.sensor.main_floor_temperature.state %}fan_needed{% else %}fan_not_needed{%endif %}'
The use case I have is that my upstairs often gets very warm (North Carolina summer) and the unit up there can’t seem to keep up. The house has an open floor plan to which I have openings between the up and downstairs and heat (albeit colder than what’s already up there) is rising to the upstairs. My main_floor AC unit keeps up all day, so I wanted a way to help the main_floor unit cool the upstairs. There is a large ceiling fan that hangs between the two levels that I’ve connected to a GE z-wave fan control. I wanted to evaluate the temperature upstairs and if is higher than the main_floor then I would turn on the overhead fan. (The fan is set to “winter” rotation, thus sucking up cold air and pushing it to the upstairs.)
Essentially, the automation rule states that if this sensor = fan_needed, hvac_mode=cool, and upstairs temp < 74 then to turn on the fan.
Hope this example helps someone else understand templates better.