Hi, i really liked the work made by Sam04, so heavly inspired by his work i created my verion of this temperature controlled fan blueprint.
Fan turns on if temperature inside is greater than the threshold value considering outside temperature (during winter). I removed the occupancy entity so the fan is dependent only from the temperature.
I use it to automatically turn on and off the cpu fan based on cpu temperature sensor, so it doesn’t make useless noise.
Make sure to set the temperature device class for sensor and fan for entity even if you use a switch like me. (you can use platform template for both)
More info here on GitHub Repo
blueprint:
name: Automatic Fan Control based on Temperature
description: "## Fan ON/OFF Automation based on temperature, outside\
\ temperature.\n\nFan turns on if the following conditions are met:\n temperature\
\ inside greater than your set threshold value\n
\ temperature outside is lower than your set maximum value (to prevent turning\
\ the fan on in winter)\n\nFan turns off if the following conditions are met:\n\
\ temperature inside is lower than your threshold value minus the hystersis value\n\
\ What the automation **NOT** observes:\n manual\
\ fan control. Adapt the given values too your needs.\n If you manually turn\
\ the fan on and the inside temperature is below the threshold your fan will turn\
\ off soon.\n\nWhat you need:\n a fan entity. if you control your fan via a switch\
\ entity (via smart plug for example) you can create a template fan entity.\n\
\ sensor entities for inside and outside temperature. (if you want to use the\
\ weather domain than create a template sensor from the temp attribute)\n
\ Inspired by Sam04"
domain: automation
input:
fan:
name: Fan
description: Fan to control
selector:
target:
entity:
domain: fan
temp_inside:
name: Temperature Inside
description: Temperature to track inside your house
selector:
entity:
domain: sensor
device_class: temperature
temp_outside:
name: Temperature Outside
description: Temperature outside to prevent to turn on the fan in winter for
example. Set to same Temperature Inside entity if you don't want to use it
selector:
entity:
domain: sensor
device_class: temperature
temp_outside_min:
name: Outside temperature
description: outside temperature that must be reached to turn on the fan (to
prevent the fan to be turned on in winter). Set to 0 to disable
selector:
number:
min: 0.0
max: 300.0
step: 0.5
unit_of_measurement: °C | °F
mode: slider
temp_threshold_inside:
name: Inside temperature threshold
description: inside threshold temperature that must be reached to turn on the
fan
selector:
number:
min: 0.0
max: 300.0
step: 0.5
unit_of_measurement: °C | °F
mode: slider
hysteresis:
name: Hysteresis
description: The difference the observed value must be lower than the threshold
value before the fan is turned off
selector:
number:
min: 0.5
max: 100.0
step: 0.5
unit_of_measurement: °C | °F
mode: slider
source_url: https://github.com/fabiosoft/automatic-fan-control-based-on-temperature
variables:
fan: !input 'fan'
temp_inside_entity: !input 'temp_inside'
temp_inside: '{{ states[temp_inside_entity].state }}'
temp_outside_entity: !input 'temp_outside'
temp_outside: '{{ states[temp_outside_entity].state }}'
temp_threshold_inside: !input 'temp_threshold_inside'
temp_outside_min: !input 'temp_outside_min'
hysteresis: !input 'hysteresis'
max_exceeded: silent
trigger:
- platform: state
entity_id: !input 'temp_inside'
- platform: state
entity_id: !input 'temp_outside'
condition: []
action:
- choose:
- conditions:
- alias: temp inside greater than temp threshold value
condition: template
value_template: '{{ temp_inside|float > temp_threshold_inside|float }}
'
- alias: temp outside greater than outside min temp
condition: template
value_template: '{{ temp_outside|float > temp_outside_min|float }}
'
sequence:
- service: homeassistant.turn_on
target: !input 'fan'
- conditions:
- condition: or
conditions:
- condition: template
value_template: '{{ (temp_threshold_inside - hysteresis)|float > temp_inside|float
}}
'
sequence:
- service: homeassistant.turn_off
target: !input 'fan'
default: []
mode: single