I thought I could try to ‘shortcut’ an automation (having a delay and then ‘off’ action all in one) using the below code and the light will turn on when motion is detected and run for the delay time before turning off, as expected, however if motion is detected a second time the light instantly turns off… why would this be? can I not code automations like this?
I tried copying that for my kitchen light but that one doesnt work at all. Given that this passage light kind of works I figured maybe i was somewhat closer to a solution with it
Your automation is perfect for turning it on. Remove the delay and the turn_off create a separate ‘off’ automation.
The key part in the example in the link above is the trigger:
trigger:
platform: state
entity_id: binary_sensor.passage_multi_sensor_sensor
to: 'off'
for:
minutes: 10
This will only trigger when your sensor has been off for 10 minutes straight. Any interruptions invalidate the trigger and it starts waiting again next time the sensor reports ‘off’.