Automatic Temperature Fan Control

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

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

How would you make something that allows you to choose a set temperature, and 4 separate temperature deviation variables, two for turning the Heating/cooling devices off that is a somewhat lower value than another two that are for turning the Heating or cooling devices on, and something that allows for using just a regular ZigBee switch to turn something on or off, or for turning the heating setting to off or the heating setting to on, on a z wave thermostat (go control z wave thermostat) and has a kinda virtual climate device to control it with the four temperature deviation values and set temperature being adjusted by it, or short of that, just four entities named appropriately that I can add to a entities card. Also, that uses the average of two sensors or more sensors, or just one sensor, to determine the temperature value to make these decisions?

Also preferably a way of adding a way to subtract one or add one to the deviation value based on an outdoor temperature sensor? But I’m not really sure how to go about that. Preferably based on how different it is from the set temperature, with a way of setting an offset due to the temperature produced by the occupants and electronics inside, possibly just another variable.

Seems like something like this could make anything into a Central heating/air conditioning system.

you can control whatever entity you added in home assistant.
For example here is my fan configuration.

  - platform: template
    fans:
      cpu_rack_fan:
        friendly_name: "CPU Rack fan"
        value_template: "{{ 'on' if is_state('switch.fan_rack', 'on') else 'off' }}"
        turn_on:
          service: switch.turn_on
          data:
            entity_id: switch.fan_rack
        turn_off:
          service: switch.turn_off
          data:
            entity_id: switch.fan_rack

As you can see my “fan” it’s not actually a fan but a smart switch inside my pc case self controlled by HA services turn_on/off

Ya I just meant theirs no like, all encompassing air conditioning control system with a template. I’ve been just using scripts combined with automations. I also don’t know how to make blueprints to make one myself. Thought maybe this guy would have pointers to make something like what I’m describing.

I use it to automatically turn on and off the cpu fan based on cpu temperature sensor, so it doesn’t make useless noise.
If you want control a complete air conditioner system, maybe you should see the climate integration.