Skip to content

Instantly share code, notes, and snippets.

@manix84
Last active June 10, 2024 14:38
Show Gist options
  • Save manix84/c16a8e46d10423e4354b5e862facc907 to your computer and use it in GitHub Desktop.
Save manix84/c16a8e46d10423e4354b5e862facc907 to your computer and use it in GitHub Desktop.
Speed up and slow down ceiling fans, as it get's hotter and colder.
blueprint:
name: Fan Temperature
description: |
Speed up and slow down ceiling fans, as it gets hotter and colder.
domain: automation
source_url: https://gist.github.com/manix84/c16a8e46d10423e4354b5e862facc907
author: Manix84
input:
fan_entity_ids:
name: Fans
description: The fans you wish to control
selector:
entity:
multiple: true
domain: fan
temperature_sensor_entity_id:
name: Temperature Sensor
description: The temperature sensor to use
selector:
entity:
device_class: temperature
temperature_low:
name: Low Temperature
description: The temperature at which the fans should be set to the lowest speed
default: 20
selector:
number:
min: 0
max: 100
unit_of_measurement: "°C"
temperature_medium:
name: Medium Temperature
description: The temperature at which the fans should be set to the medium speed
default: 25
selector:
number:
min: 0
max: 100
unit_of_measurement: "°C"
temperature_high:
name: High Temperature
description: The temperature at which the fans should be set to the highest speed
default: 30
selector:
number:
min: 0
max: 100
unit_of_measurement: "°C"
trigger:
platform: state
entity_id: !input temperature_sensor_entity_id
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor_entity_id
above: !input temperature_high
sequence:
- condition: not
conditions:
- condition: state
entity_id: !input fan_entity_ids
attribute: preset_mode
state: "high"
- service: fan.set_preset_mode
target:
entity_id: !input fan_entity_ids
data:
preset_mode: "high"
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor_entity_id
below: !input temperature_high
above: !input temperature_medium
sequence:
- condition: not
conditions:
- condition: state
entity_id: !input fan_entity_ids
attribute: preset_mode
state: "medium"
- service: fan.set_preset_mode
target:
entity_id: !input fan_entity_ids
data:
preset_mode: "medium"
- conditions:
- condition: numeric_state
entity_id: !input temperature_sensor_entity_id
below: !input temperature_medium
above: !input temperature_low
sequence:
- condition: not
conditions:
- condition: state
entity_id: !input fan_entity_ids
attribute: preset_mode
state: "low"
- service: fan.set_preset_mode
target:
entity_id: !input fan_entity_ids
data:
preset_mode: "low"
default:
- condition: not
conditions:
- condition: or
conditions:
- condition: state
entity_id: !input fan_entity_ids
attribute: preset_mode
state: off
- condition: state
entity_id: !input fan_entity_ids
state: "off"
- service: fan.set_preset_mode
target:
entity_id: !input fan_entity_ids
data:
preset_mode: "off"
- service: fan.turn_off
target:
entity_id: !input fan_entity_ids
mode: restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment