fan stays on, trying to fix that
This commit is contained in:
@ -58,9 +58,11 @@ trigger:
|
|||||||
entity_id: !input bathroom_lights
|
entity_id: !input bathroom_lights
|
||||||
from: 'off'
|
from: 'off'
|
||||||
to: 'on'
|
to: 'on'
|
||||||
- platform: state
|
|
||||||
entity_id: !input bathroom_lights
|
- platform: template
|
||||||
to: 'off'
|
value_template: >
|
||||||
|
{{ expand(inputs.bathroom_lights) | selectattr('state','eq','on') | list | count == 0 }}
|
||||||
|
|
||||||
- platform: time_pattern
|
- platform: time_pattern
|
||||||
minutes: "/5"
|
minutes: "/5"
|
||||||
|
|
||||||
@ -68,7 +70,7 @@ condition: []
|
|||||||
|
|
||||||
action:
|
action:
|
||||||
- choose:
|
- choose:
|
||||||
# Turn fan on when any light turns on
|
# When any light turns on, start fan after delay
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
@ -79,19 +81,18 @@ action:
|
|||||||
target:
|
target:
|
||||||
entity_id: !input fan_entity
|
entity_id: !input fan_entity
|
||||||
|
|
||||||
# Turn fan off after all lights have been off for a duration
|
# When all lights are off, delay then turn off fan
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
{{ trigger.platform == 'state' and
|
{{ expand(inputs.bathroom_lights) | selectattr('state','eq','on') | list | count == 0 }}
|
||||||
expand(inputs.bathroom_lights) | selectattr('state','eq','on') | list | count == 0 }}
|
|
||||||
sequence:
|
sequence:
|
||||||
- delay: !input time_fan_stays_on_after_lights_off
|
- delay: !input time_fan_stays_on_after_lights_off
|
||||||
- service: fan.turn_off
|
- service: fan.turn_off
|
||||||
target:
|
target:
|
||||||
entity_id: !input fan_entity
|
entity_id: !input fan_entity
|
||||||
|
|
||||||
# Periodic cadence run
|
# Cadence mode
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: >
|
||||||
|
Reference in New Issue
Block a user