fan stays on, trying to fix that

This commit is contained in:
2025-07-05 18:58:29 +00:00
parent 28a69cd3d2
commit 7495cb1f25

View File

@ -58,9 +58,11 @@ trigger:
entity_id: !input bathroom_lights
from: 'off'
to: 'on'
- platform: state
entity_id: !input bathroom_lights
to: 'off'
- platform: template
value_template: >
{{ expand(inputs.bathroom_lights) | selectattr('state','eq','on') | list | count == 0 }}
- platform: time_pattern
minutes: "/5"
@ -68,7 +70,7 @@ condition: []
action:
- choose:
# Turn fan on when any light turns on
# When any light turns on, start fan after delay
- conditions:
- condition: template
value_template: >
@ -79,19 +81,18 @@ action:
target:
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:
- condition: 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:
- delay: !input time_fan_stays_on_after_lights_off
- service: fan.turn_off
target:
entity_id: !input fan_entity
# Periodic cadence run
# Cadence mode
- conditions:
- condition: template
value_template: >