Compare commits
7 Commits
99220e5db5
...
main
Author | SHA1 | Date | |
---|---|---|---|
fbecc55c8f | |||
a7274f6053 | |||
0a2381e91b | |||
93441c06e8 | |||
d57df68cb5 | |||
7495cb1f25 | |||
28a69cd3d2 |
69
fan-cadence.yaml
Normal file
69
fan-cadence.yaml
Normal file
@ -0,0 +1,69 @@
|
||||
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
|
@ -1,107 +1,77 @@
|
||||
blueprint:
|
||||
name: Bathroom Fan Controller
|
||||
name: Bathroom Fan Manager
|
||||
description: >
|
||||
Turns on the fan when any bathroom light is on (after a delay), keeps it on
|
||||
after all lights are off for a specified time, and also runs the fan on a
|
||||
regular cadence (e.g., every hour for 5 minutes).
|
||||
Turns fan on with bathroom lights (after optional delay), keeps it on while any light is on, and turns it off after all lights are off and a timeout.
|
||||
domain: automation
|
||||
input:
|
||||
fan_entity:
|
||||
name: Bathroom Fan
|
||||
description: The fan to control
|
||||
fan:
|
||||
name: Fan Entity
|
||||
selector:
|
||||
entity:
|
||||
domain: fan
|
||||
bathroom_lights:
|
||||
name: Bathroom Lights
|
||||
description: One or more lights in the bathroom
|
||||
|
||||
lights:
|
||||
name: Bathroom Light Entities
|
||||
selector:
|
||||
entity:
|
||||
domain: light
|
||||
multiple: true
|
||||
delay_after_light_on:
|
||||
name: Delay After Light On
|
||||
description: Delay before turning on the fan once any light is turned on
|
||||
|
||||
delay_before_fan_on:
|
||||
name: Delay Before Turning Fan On
|
||||
description: Time to wait after any light turns on before turning on the fan.
|
||||
default: 0
|
||||
selector:
|
||||
duration:
|
||||
time_fan_stays_on_after_lights_off:
|
||||
name: Duration Fan Stays On After Lights Off
|
||||
description: How long the fan should stay on after all lights are off
|
||||
default: 00:05:00
|
||||
selector:
|
||||
duration:
|
||||
cadence_enabled:
|
||||
name: Enable Cadence Mode
|
||||
description: Enable periodic fan activation
|
||||
default: true
|
||||
selector:
|
||||
boolean:
|
||||
cadence_interval:
|
||||
name: Cadence Interval
|
||||
description: Time between fan activations
|
||||
default: 01:00:00
|
||||
selector:
|
||||
duration:
|
||||
cadence_duration:
|
||||
name: Cadence Duration
|
||||
description: How long the fan stays on during each cadence
|
||||
default: 00:05:00
|
||||
selector:
|
||||
duration:
|
||||
number:
|
||||
min: 0
|
||||
max: 300
|
||||
unit_of_measurement: seconds
|
||||
|
||||
mode: parallel
|
||||
max: 5
|
||||
time_fan_stays_on_after_lights_off:
|
||||
name: Time Fan Stays On After All Lights Are Off
|
||||
description: Time to keep the fan running after all lights are off.
|
||||
default: 300
|
||||
selector:
|
||||
number:
|
||||
min: 0
|
||||
max: 3600
|
||||
unit_of_measurement: seconds
|
||||
|
||||
mode: restart
|
||||
|
||||
trigger:
|
||||
- platform: state
|
||||
entity_id: !input bathroom_lights
|
||||
from: 'off'
|
||||
to: 'on'
|
||||
- platform: state
|
||||
entity_id: !input bathroom_lights
|
||||
to: 'off'
|
||||
for: !input time_fan_stays_on_after_lights_off
|
||||
- platform: time_pattern
|
||||
minutes: "/5"
|
||||
entity_id: !input lights
|
||||
to:
|
||||
- "on"
|
||||
- "off"
|
||||
|
||||
condition: []
|
||||
variables:
|
||||
fan_entity: !input fan
|
||||
lights: !input lights
|
||||
|
||||
action:
|
||||
- choose:
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.platform == 'state' and
|
||||
trigger.to_state.state == 'on' }}
|
||||
{{ expand(lights) | selectattr('state', 'eq', 'on') | list | count > 0 }}
|
||||
sequence:
|
||||
- delay: !input delay_after_light_on
|
||||
- delay:
|
||||
seconds: !input delay_before_fan_on
|
||||
- service: fan.turn_on
|
||||
target:
|
||||
entity_id: !input fan_entity
|
||||
|
||||
entity_id: "{{ fan_entity }}"
|
||||
- conditions:
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.platform == 'state' and
|
||||
trigger.to_state.state == 'off' and
|
||||
expand(inputs.bathroom_lights) | selectattr('state','eq','on') | list | count == 0 }}
|
||||
{{ expand(lights) | selectattr('state', 'eq', 'on') | list | count == 0 }}
|
||||
sequence:
|
||||
- delay: !input time_fan_stays_on_after_lights_off
|
||||
- service: fan.turn_off
|
||||
target:
|
||||
entity_id: !input fan_entity
|
||||
|
||||
- conditions:
|
||||
- delay:
|
||||
seconds: !input time_fan_stays_on_after_lights_off
|
||||
- condition: template
|
||||
value_template: >
|
||||
{{ trigger.platform == 'time_pattern' and cadence_enabled }}
|
||||
sequence:
|
||||
- service: fan.turn_on
|
||||
target:
|
||||
entity_id: !input fan_entity
|
||||
- delay: !input cadence_duration
|
||||
{{ expand(lights) | selectattr('state', 'eq', 'on') | list | count == 0 }}
|
||||
- service: fan.turn_off
|
||||
target:
|
||||
entity_id: !input fan_entity
|
||||
|
||||
entity_id: "{{ fan_entity }}"
|
||||
|
Reference in New Issue
Block a user