Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save michaelp85/0b60a8ccbc9f5a55d626be59d2f5c1c8 to your computer and use it in GitHub Desktop.
Save michaelp85/0b60a8ccbc9f5a55d626be59d2f5c1c8 to your computer and use it in GitHub Desktop.
temperature-control-exhaust-fan.yaml
blueprint:
name: 3D Printer Enclosure Fan Control
description: >
# Forked from Blackshome/temperature-control-exhaust-fan.yaml
# 3D Printer Enclosure Fan Control
**Version: 1.0**
The most common automation used for a Temperature Control Exhaust Fan. It really can turn anything ON and OFF on a rising & falling numeric value.
Let us know what you think of this blueprint and for community support including updates: [Click Here](https://community.home-assistant.io/t/temperature-control-exhaust-fan/515861/1)
**The Automation Process:**
- When the sensor rises above the set value it turns the fan ON.
- When the sensor falls below the set value it turns the fan OFF.
- You have the option to use the "Fan Speed - Off Switch Option". This is useful for turning OFF fans with different speeds.
- You have the option to use the "Trigger Sensor By-pass". This allows you to add a switch to manually By-pass the trigger sensor so you can use the fan as normal by turning it ON and OFF manually.
- You have the option to set a start time, an end time and select weekdays. This will only allow the automation to run between the time periods.
Note: If you turn the fan on manually and the automation runs it will turn the fan OFF automatically. It is recommended to use the "Trigger Sensor By-pass" option if you would like to keep the fan ON or OFF for extended time periods.
Required = *
**Need help?** See our FAQ: [Click Here](https://community.home-assistant.io/t/temperature-control-exhaust-fan/515861/2)
**Like my blueprints and would like to send me a gift?** [My PayPal Link](https://www.paypal.com/paypalme/Blackshome) 🙂
domain: automation
input:
trigger_sensor:
name: Trigger Sensor *
description: The trigger can be any sensor you like that has a numeric value.
selector:
entity:
domain:
- sensor
entity_turn_on:
name: Fan Switch *
description: Enter the fan you would like to turn ON. Can be any switch you like.
selector:
target:
entity:
domain:
- switch
- fan
entity_turn_off:
name: Fan Speed - Off Switch Option (Optional)
description: Sometimes you need to select a different entity to turn the fan OFF.
This is normally used when having a fan that has different speeds.
Please DO NOT select the same entities that are selected above in "Fan Switch" here, as the automation will not work.
default: []
selector:
entity:
multiple: true
domain:
- switch
- fan
rising_value:
name: Rising Value
description: The rising value to turn the fan ON.
default: 20
selector:
number:
min: 0
max: 100
step: 0.5
unit_of_measurement: value
falling_value:
name: Falling Value
description: The falling value to turn the fan OFF.
default: 20
selector:
number:
min: 0
max: 100
step: 0.5
unit_of_measurement: value
include_bypass:
name: Use The Trigger Sensor By-pass Option (Optional)
description: Select enable or disable.
default: bypass_disabled
selector:
select:
options:
- label: Enable the By-pass option
value: "bypass_enabled"
- label: Disable the By-pass option
value: "bypass_disabled"
trigger_bypass:
name: Trigger Sensor By-pass
description: Select a switch that will By-pass the trigger sensor and make your fan function as normal.
The entity cannot be included in the "Fan Switch" selection.
default: []
selector:
entity:
include_time:
name: Use The Time Options (Optional)
description: Use the "Start Time", "End Time" and the "Weekdays" values to only run the automation between the time periods.
default: time_disabled
selector:
select:
options:
- label: Enable the time options
value: "time_enabled"
- label: Disable the time options
value: "time_disabled"
after_time:
name: Start Time
description: Set the start time.
default: 00:00:00
selector:
time:
before_time:
name: End Time
description: Set the end time.
default: 00:00:00
selector:
time:
weekday_options:
name: Weekdays
description: Select the days of the week you would like the automation to run. You must select "Enable the time options" above for the weekdays selections to work.
default:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
selector:
select:
multiple: true
mode: list
options:
- label: Monday
value: "mon"
- label: Tuesday
value: "tue"
- label: Wednesday
value: "wed"
- label: Thursday
value: "thu"
- label: Friday
value: "fri"
- label: Saturday
value: "sat"
- label: Sunday
value: "sun"
# If the temp rises above the set point again it will restart the automation.
mode: restart
max_exceeded: silent
variables:
trigger_sensor: !input trigger_sensor
entity_turn_on: !input entity_turn_on
entity_turn_off: !input entity_turn_off
rising_value: !input rising_value
falling_value: !input falling_value
include_bypass: !input include_bypass
trigger_bypass: !input trigger_bypass
include_time: !input include_time
after_time: !input after_time
before_time: !input before_time
weekday_options: !input weekday_options
trigger:
- platform: numeric_state
id: "t1"
entity_id: !input trigger_sensor
above: !input rising_value
- platform: time
id: "t2"
at: !input after_time
- platform: state
id: "t3"
entity_id: !input trigger_bypass
from: "on"
to: "off"
# All Conditions
condition:
#Trigger conditions
- condition: or
conditions:
- condition: and # trigger on rising value is above set point
conditions:
- condition: numeric_state
entity_id: !input trigger_sensor
above: !input rising_value
- condition: and # trigger by time & check rising value is above set point
conditions:
- condition: numeric_state
entity_id: !input trigger_sensor
above: !input rising_value
- condition: trigger
id: 't2'
- condition: and # trigger by by-pass & check rising value is above set point
conditions:
- condition: numeric_state
entity_id: !input trigger_sensor
above: !input rising_value
- condition: trigger
id: 't3'
# Check the By-pass
- condition: or
conditions:
- "{{ include_bypass == 'bypass_disabled' }}"
- "{{ trigger_bypass == [] }}"
- "{{ (include_bypass == 'bypass_enabled') and (states[trigger_bypass].state == 'off') }}"
# Check the time options
- condition: or
conditions:
- "{{ include_time == 'time_disabled' }}"
- condition: and
conditions:
- condition: time
after: !input after_time
before: !input before_time
weekday: !input weekday_options
- "{{ include_time == 'time_enabled' }}"
action:
- alias: "Turn on the entity"
service: homeassistant.turn_on
target: !input entity_turn_on
- alias: "Wait until sensor is below set value"
wait_for_trigger:
platform: numeric_state
entity_id: !input trigger_sensor
below: !input falling_value
- alias: "Turn off the entity"
service: homeassistant.turn_off
target: !input entity_turn_on
- alias: "Fan speed off option"
service: homeassistant.turn_on
entity_id: !input entity_turn_off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment