Based on the blueprint, I created an automation that controls the lighting. The trigger is a motion sensor. The problem is that the parameter Time to leave the light on after last motion is detected set to 5 min does not switch off after this time period at all. It switches off after 2 min. I absolutely do not understand why this is happening. Please help and explain. Where is the error?
alias: Toilet motion
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.ikea_tradfri_motion_sensor_motion
from: "off"
to: "on"
condition: []
action:
- if:
- condition: state
entity_id: schedule.nighttime
state: "off"
then:
- alias: Turn on the light
data: {}
action: switch.turn_on
target:
entity_id: switch.sonoff_zbminil2_1_switch
- alias: Wait until there is no motion from device
wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.ikea_tradfri_motion_sensor_motion
from: "on"
to: "off"
timeout:
hours: 0
minutes: 0
seconds: 0
milliseconds: 0
- alias: Time to leave the light on after last motion is detected
delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- alias: Turn off the light
data: {}
action: switch.turn_off
target:
entity_id: switch.sonoff_zbminil2_1_switch
mode: restart
max_exceeded: silent
````Preformatted text`