Let’s say we setup a simple automation, triggered by an motion sensor event and control a light.
“if motion event happenedd” -> “turn on the light” -> “delay 2 mins” -> “turn off the light”
Then I tested this by firing the trigger event in web UI deverloper tools manually.
Fire the event only one time, everything works perfect as expected.
But if fire the event twice before the 2mins delay is over. The light goes off on the second event fired
At first I suspect the problem may comes with the light turn_on service. So I invoke the turn_on service manually twice, the light didn’t turned off like the automation did.
So where did I do wrong?
here is the automation yaml:
- id: '1552436834458'
alias: Study Light
trigger:
- event_data:
entity_id: binary_sensor.motion_sensor_155d000157c7e3
event_type: xiaomi_aqara.motion
platform: event
condition: []
action:
- data:
entity_id: light.study
service: light.turn_on
- delay: 00:02:00
- data:
entity_id: light.study
service: light.turn_off