I have a bathroom light triggered by a motion sensor. The cooldown period of this sensor is ~5minutes. So I created a script that waits for a new motion to keep the light on. The waiting time is 8 minutes so that should be long enough. Below the script. But somehow it doesn’t work. I expect when the motion sensor is triggered again the flow starts All over and the waiting periods starts again. But somehow this doesn’t work. What is wrong?
alias: WC lamp
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.wc_motion
from: "off"
to: "on"
condition: []
action:
- type: turn_on
device_id: 6a244411113a29f24d9bf18b3af7e
entity_id: light.wand_lamp_2
domain: light
brightness_pct: 60
- wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.wc_motion
to: "on"
from: "off"
- platform: state
entity_id:
- binary_sensor.wc_motion
from: "off"
timeout:
hours: 0
minutes: 8
seconds: 0
milliseconds: 0
continue_on_timeout: true
- type: turn_off
device_id: 6a244411113a29f91a9bf18b3af7e
entity_id: light.wand_lamp_2
domain: light
mode: single