Hello everyone!
New HA user here. I have this automation to turn on the lights by the motion sensor and turn them it off after a delay when motion is clean.
alias: Kitchen motion light
description: ""
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_light
id: Kitchen Timer Finished
- type: no_motion
platform: device
device_id: d522ab083e3e5dd398148
entity_id: binary_sensor.0x00124b002_occupancy
domain: binary_sensor
id: Kitchen Motion Stopped
- type: motion
platform: device
device_id: d522ab083e3e5dd3981489568
entity_id: binary_sensor.0x00124b00291_occupancy
domain: binary_sensor
id: Kitchen Detected
- platform: event
event_type: state.on
event_data:
entity_id: light.kitchen
id: Lights On
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Kitchen Motion Stopped
sequence:
- service: timer.start
data:
duration: "60"
target:
entity_id: timer.kitchen_light
- conditions:
- condition: trigger
id: Kitchen Detected
sequence:
- service: timer.cancel
data: {}
target:
entity_id: timer.kitchen_light
- service: light.turn_on
data:
brightness_pct: 79
target:
entity_id: light.kitchen
- conditions:
- condition: trigger
id: Kitchen Timer Finished
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.kitchen
mode: single
How can I update it to start the timer in case lights turned on by traditional switch or from the dashboard? I tried to change it in this way but it was not working.
alias: Kitchen motion light
description: ""
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.kitchen_light
id: Kitchen Timer Finished
- type: no_motion
platform: device
device_id: d522ab083e3e5dd39814895681
entity_id: binary_sensor.0x00124b00291_occupancy
domain: binary_sensor
id: Kitchen Motion Stopped
- type: motion
platform: device
device_id: d522ab083e3e5dd39814895681c
entity_id: binary_sensor.0x00124b0029_occupancy
domain: binary_sensor
id: Kitchen Detected
- platform: event
event_type: state.on
event_data:
entity_id: light.kitchen
id: Lights On
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Kitchen Motion Stopped
sequence:
- service: timer.start
data:
duration: "60"
target:
entity_id: timer.kitchen_light
- conditions:
- condition: trigger
id: Kitchen Detected
sequence:
- service: timer.cancel
data: {}
target:
entity_id: timer.kitchen_light
- service: light.turn_on
data:
brightness_pct: 79
target:
entity_id: light.kitchen
- conditions:
- condition: trigger
id: Kitchen Timer Finished
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.kitchen
- conditions:
- condition: state
entity_id: light.kitchen
state: "on"
for:
hours: 0
minutes: 1
seconds: 0
sequence:
- service: timer.start
data:
duration: "60"
target:
entity_id: timer.kitchen_light
mode: single