I writed an automation to turn on two light during 10 minutes when I open my front door, only the night. It works well, but when I close and re-open my door, the light turn off immediatly, and I don’t know why. If you have an idea, I’ll take it !
Do tout want the light to turn off after 10 min regardless of the door state, or would it make more sense for the light to turn off if the door was closed for 10 min?
If so I would break this into 2 automations. Keep the ones you have to turn on, create another one to turn off, with trigger:
- alias: Lamp Off
trigger:
platform: state
entity_id: binary_sensor.front_door
to: "off"
for:
minutes: 10
If the automation is re-triggered while waiting in the delay it will skip the remaining delay and continue with execution of the actions. The solution is provided by @lolouk44. Don’t use a delay. Use two automations.