Hi all,
I want to create an automation that turns on a ceiling fan when a thermostat is reporting a lower temperature than a second thermostat. My initial thought is to use a trigger like this:
triggers:
- trigger: template
value_template: >-
{{ states('climate.great_room_ecobee') == 'heat' and
(state_attr('climate.great_room_ecobee', 'current_temperature') <
state_attr('climate.2nd_floor_heat_ecobee', 'current_temperature')) and
states('fan.great_room') == 'off' }}
But then it occurred to me that it might be better for the trigger to just focus on the states that I truly care about, and have the other checks in a conditional block:
triggers:
- trigger: template
value_template: >-
{{
(state_attr('climate.great_room_ecobee', 'current_temperature') <
state_attr('climate.2nd_floor_heat_ecobee', 'current_temperature')) }}
conditions:
- condition: state
entity_id: climate.great_room_ecobee
state: heat
- condition: state
entity_id: fan.great_room
state: "off"
Is there any significant difference between these (other than cosmetic, etc)? Is this even the right approach to take for something like this? I’m a bit curious as to how HA even determines when to trigger this automation. Is it going to constantly evaluate that template for the final value, or is it smart enough to know what attributes I’ve specified and only evaluates the conditional when one of them changes?