I have a motion sensor that triggers lights in my kitchen. I want the lights to stay on while I’m in there, and if no motion is detected for them to dim and then turn off.
One thing I found as if they begin the “off” automation and I walk back in there, they will still turn off. I set the “off” automation to turn off then back on in order to stop it if it’s currently running. Is there a more elegant way to do this?
- id: '1608659020753'
alias: Kitchen Motion Daytime
trigger:
- type: motion
platform: device
device_id: ac21d93e1d4ae70f9dd21699230e185f
entity_id: binary_sensor.hue_motion_sensor_1_motion
domain: binary_sensor
condition:
- condition: sun
before: sunset
after: sunrise
action:
- service: hue.hue_activate_scene
data:
group_name: Kitchen
scene_name: Relax
- service: automation.turn_off
data:
entity_id: automation.kitchen_motion_off
- service: automation.turn_on
data:
entity_id: automation.kitchen_motion_off
mode: restart
- id: '1608659065203'
alias: Kitchen Motion Night Time
trigger:
- type: motion
platform: device
device_id: ac21d93e1d4ae70f9dd21699230e185f
entity_id: binary_sensor.hue_motion_sensor_1_motion
domain: binary_sensor
condition:
- condition: sun
before: sunrise
after: sunset
action:
- service: hue.hue_activate_scene
data:
group_name: Kitchen
scene_name: Dimmed
- service: automation.turn_off
data:
entity_id: automation.kitchen_motion_off
- service: automation.turn_on
data:
entity_id: automation.kitchen_motion_off
mode: restart
- alias: Kitchen Motion Off
trigger:
- platform: state
entity_id: binary_sensor.hue_motion_sensor_1_motion
to: 'off'
for: "00:02:30"
action:
- service: hue.hue_activate_scene
data:
group_name: Kitchen
scene_name: Nightlight
- delay: 00:00:30
- service: light.turn_off
data:
entity_id: light.kitchen_lights
mode: single