Only run timer on unoccupied if lights are on

Also don't restart timer if it was already running.
This commit is contained in:
2023-03-19 15:31:50 -04:00
parent 2f75b62aae
commit cc59d36401

View File

@ -662,11 +662,21 @@ automation:
- condition: trigger - condition: trigger
id: basement-unoccupied id: basement-unoccupied
sequence: sequence:
- service: timer.start - if:
target: - condition: state
entity_id: timer.basement_studio_door_timer entity_id: light.basement_studio_lights
data: state: 'on'
duration: "{{ (states('input_number.basement_studio_lights_off_delay') | int ) * 60 }}" then:
- if:
- condition: state
entity_id: timer.basement_studio_door_timer
state: idle
then:
- service: timer.start
target:
entity_id: timer.basement_studio_door_timer
data:
duration: "{{ (states('input_number.basement_studio_lights_off_delay') | int ) * 60 }}"
- conditions: - conditions:
- condition: trigger - condition: trigger
id: timer-finished id: timer-finished