I want to achieve such a function:
The lamp is turned on for 10 seconds when the door_window_sensor is turned off. And the time when the door_window_sensor is turned off again during 10 seconds of the lamp is turned on and the time when the lamp is turned on is restarted after 10 seconds.
My automation.yaml configuration is as follows:
- action:
- alias: start
data:
entity_id: light.gateway_light_34ce008d77d0
service: light.turn_on
- delay: 00:00:10
- alias: over
data:
entity_id: light.gateway_light_34ce008d77d0
service: light.turn_off
alias: switch_test
condition: []
id: '1505358810232'
trigger:
- entity_id: binary_sensor.door_window_sensor_158d000120c834
from: 'on'
platform: state
to: 'off'
But in my test encountered such a problem:
When the lights open, I did not wait 10 seconds to close the door_window_sensor again, the lights are immediately closed.
How should I modify it to achieve what I want?
Thanks!