Hi, I'm trying to get my light switch to turn on when motion is detected, stay on for ten minutes, and then turn off unless it sees motion at the end of the ten minutes, at which point it just stays on for another ten minutes. The automation works except for the "stay on if you still detect motion at ten minutes" part. I don't think I'm doing the while loop correctly and I assume I'm messing up the trigger. Any quick review of my yaml is appreciated!
`alias: Garage Lights
description: ""
triggers:
- type: motion
device_id: detectorID
entity_id: detectEntityID
domain: binary_sensor
trigger: device
conditions: []
actions: - action: switch.turn_on
metadata: {}
data: {}
target:
device_id: switchID - delay:
minutes: 10 - repeat:
while:
- condition: trigger
id: automation.garage_lights
sequence:
- delay:
minutes: 10 - action: switch.turn_off
metadata: {}
data: {}
target:
device_id: switchID - delay:
seconds: 10
mode: single`