Files
blueprints/fan-cadence.yaml

70 lines
1.6 KiB
YAML

blueprint:
name: Fan Cadence with Light Check
description: >
Turns a fan on every X minutes for Y seconds, but only turns it off if none of the specified lights are on.
domain: automation
input:
fan_entity:
name: Fan Entity
selector:
entity:
domain: fan
interval_minutes:
name: Interval Between Fan Cycles (minutes)
default: 15
selector:
number:
min: 1
max: 1440
unit_of_measurement: minutes
duration_seconds:
name: Fan On Duration (seconds)
default: 60
selector:
number:
min: 5
max: 3600
unit_of_measurement: seconds
override_lights:
name: Override Lights
description: Fan will not turn off if any of these lights are on
selector:
entity:
domain: light
multiple: true
trigger:
- platform: homeassistant
event: start
variables:
fan: !input fan_entity
lights: !input override_lights
interval: !input interval_minutes
duration: !input duration_seconds
condition: []
action:
- repeat:
while: []
sequence:
- service: fan.turn_on
target:
entity_id: "{{ fan }}"
- delay:
seconds: "{{ duration }}"
- condition: template
value_template: >
{{ expand(lights) | map(attribute='state') | select('eq', 'on') | list | length == 0 }}
- service: fan.turn_off
target:
entity_id: "{{ fan }}"
- delay:
minutes: "{{ interval }}"
mode: restart