alias: HVAC Fan Off id: automation_hvac_fan_off trigger: # Has the fan been running for ten minutes? - platform: state entity_id: switch.thermostat_fan_mode to: 'on' for: '00:10:00' # Did the system turn on? - platform: state entity_id: sensor.hvac_action from: 'idle' # Check the conditions every 5 minutes - platform: time_pattern minutes: '/5' - platform: state entity_id: input_boolean.allow_fan to: 'off' condition: # Is the fan currently on? - condition: state entity_id: switch.thermostat_fan_mode state: 'on' - condition: or conditions: # Is it getting too warm outside? - condition: and conditions: - condition: numeric_state entity_id: sensor.thermostat_temperature above: 68 - condition: state entity_id: binary_sensor.warmer_outside state: 'on' # Is it getting too cool outside? - condition: and conditions: - condition: numeric_state entity_id: sensor.thermostat_temperature below: 65 - condition: state entity_id: binary_sensor.cooler_outside state: 'on' # Did the system turn on? - condition: not conditions: - condition: state entity_id: sensor.hvac_action state: 'idle' action: - service: logbook.log data_template: name: HVAC Fan Off entity_id: automation.hvac_fan_off message: > Turned off HVAC fan - service: homeassistant.turn_off entity_id: switch.thermostat_fan_mode