Hi,
I am trying to setup a simple automation, that responds to a motion sensor and turns on a light. The light remains on for a period, and then shuts off. I tried basing my config on this cookbook: https://www.home-assistant.io/cookbook/turn_on_light_for_10_minutes_when_motion_detected/
Unfortunately, this cookbook does not reset the timer, should motion be detected within the ‘on’ period. So it’ll turn the lights off, even if motion continues. This behavior has been experienced by others, and is the subject of an open bug report: https://github.com/home-assistant/home-assistant/issues/12013
The simple solution seems to be that you need to cancel and then manually start the timer within the automation, however my attempt at this does not work. Can anyone suggest what I’m missing?
automations.yml
- id: 'OfficeMotionLight'
alias: 'Turn lights on when motion seen'
trigger:
platform: state
entity_id: sensor.fibaro_system_fgms001_zw5_motion_sensor_burglar
#above: 200
action:
- service: light.turn_on
entity_id: light.office
- service: timer.cancel
entity_id: timer.officelight
- service: timer.start
entity_id: timer.officelight
- id: 'OfficeLightOff'
alias: 'Turn office lights off after delay'
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.officelight
action:
service: light.turn_off
data:
entity_id: light.office
configuration.yml
timer:
officelight:
duration: '00:10:00'
TIA