66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
blueprint:
|
|
name: Fan Cadence with Light Check
|
|
description: >
|
|
Runs a fan on a cadence every X minutes.
|
|
Turns it off after Y seconds unless any of the specified lights are on.
|
|
domain: automation
|
|
input:
|
|
fan_entity:
|
|
name: Fan Entity
|
|
selector:
|
|
entity:
|
|
domain: fan
|
|
|
|
interval_minutes:
|
|
name: Fan Activation Interval (minutes)
|
|
description: How often to turn the fan on
|
|
default: 15
|
|
selector:
|
|
number:
|
|
min: 1
|
|
max: 1440
|
|
unit_of_measurement: minutes
|
|
|
|
duration_seconds:
|
|
name: How Long to Keep Fan On (seconds)
|
|
description: How long the fan stays on before trying to turn it off
|
|
default: 60
|
|
selector:
|
|
number:
|
|
min: 5
|
|
max: 3600
|
|
unit_of_measurement: seconds
|
|
|
|
override_lights:
|
|
name: Override Lights
|
|
description: Fan will not be turned off if any of these lights are on
|
|
selector:
|
|
entity:
|
|
domain: light
|
|
multiple: true
|
|
|
|
trigger:
|
|
- platform: time_pattern
|
|
minutes: "/{{ iif(interval_minutes | int > 0, interval_minutes, 15) }}"
|
|
|
|
variables:
|
|
fan: !input fan_entity
|
|
lights: !input override_lights
|
|
|
|
condition: []
|
|
|
|
action:
|
|
- service: fan.turn_on
|
|
target:
|
|
entity_id: "{{ fan }}"
|
|
- delay:
|
|
seconds: !input duration_seconds
|
|
- condition: template
|
|
value_template: >
|
|
{{ lights | map('states') | select('eq', 'on') | list | length == 0 }}
|
|
- service: fan.turn_off
|
|
target:
|
|
entity_id: "{{ fan }}"
|
|
|
|
mode: parallel
|