Skip to content

Instantly share code, notes, and snippets.

@loca5790
Last active February 7, 2024 02:45
Show Gist options
  • Save loca5790/1d3eed1779189d88e00af7bbe8c29035 to your computer and use it in GitHub Desktop.
Save loca5790/1d3eed1779189d88e00af7bbe8c29035 to your computer and use it in GitHub Desktop.
fan blueprint
blueprint:
name: Bathroom Fan Humidity Control
description: A first pass at controlling bathroom fans by checking the change in humidity and being able to enter your own guesses for certain thresholds.
domain: automation
input:
humidity_derivative_sensor:
name: Humidity Derivative Sensor
description: IMPORTANT set up a derivative sensor for your humidity in configuration.yaml and restart before using this!
selector:
entity:
humidity_change_percent_to_start:
name: Percent change to start fan
description: Over the given period of time, how much % should the humidity have risen to trigger this fan.
default: 10
selector:
number:
min: 1
max: 100
fan_switch_target:
name: Fan Switch
default: []
selector:
target:
entity:
domain: switch
time_to_run:
name: Duration of time to run
description: once humidity threshold has been reached, run the fan for this long. Restart the timer if the threshold gets reached again.
default: 10
selector:
number:
min: 0
max: 60
step: 0.5
unit_of_measurement: minutes
manual_switch:
name: Manual Fan Switch
description: Manually turn on the fan
default: []
selector:
target:
entity:
domain: switch
trigger:
- platform: numeric_state
entity_id: !input humidity_derivative_sensor
above: !input humidity_change_percent_to_start
below: "100"
- platform: state
entity_id: !input manual_switch
to: 'on'
condition:
- condition: numeric_state
entity_id: !input humidity_derivative_sensor
above: !input humidity_change_percent_to_start
below: '100'
action:
- service: switch.turn_on
target: !input fan_switch_target
- wait_for_trigger:
- platform: state
entity_id: !input humidity_derivative_sensor
to: 'off'
- service: switch.turn_off
target: !input fan_switch_target
mode: restart
max_exceeded: silent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment