Hi everyone,
I’m working on an automation for my above-sink lights that uses 1 dimmer switch (Hue 4-button dimmer) and 1 motion sensor (Hue indoor motion sensor). I’ve got the basic functionality working, but I’m struggling to set different auto-off times based on the initial trigger.
Here’s the desired behavior:
- Dimmer Switch Trigger:
- When the dimmer switch is pressed:
- Lights turn on to full brightness.
- If there’s no motion for 5 minutes, the lights automatically turn off.
- Motion Sensor Trigger:
- When motion is detected (and it’s dark enough):
- Lights turn on to an appropriate brightness level (using a script).
- If there’s no motion for 1 minute, the lights automatically turn off.
Current Automation:
alias: Above Sink Lights Motion Detection
description: >-
triggers:
- device_id: Kitchen dimmer
domain: hue
type: initial_press
subtype: 1
trigger: device
id: kitchen-dimmer-pressed
- type: motion
device_id: Kitchen motion sensor
domain: binary_sensor
trigger: device
id: kitchen-motion-detected
- type: no_motion
device_id: Kitchen motion sensor
domain: binary_sensor
trigger: device
for:
hours: 0
minutes: 1
seconds: 0
id: kitchen-nomotion-detected
- device_id: Kitchen dimmer
domain: hue
type: initial_press
subtype: 4
trigger: device
id: kitchen-dimmer-pressed-off
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: kitchen-dimmer-pressed
sequence:
- target:
entity_id: scene.kitchen_shine
action: scene.turn_on
data:
transition: 1
- conditions:
- condition: trigger
id: kitchen-motion-detected
- type: is_illuminance
condition: device
device_id: Kitchen motion sensor
domain: sensor
below: 16
sequence:
- action: script.kitchen_sensor_light_conditions
data: {}
- if:
- condition: state
entity_id: light.kitchen
state: "off"
then:
- action: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.kitchen_light_manual
- conditions:
- condition: trigger
id: kitchen-dimmer-pressed-off
sequence:
- target:
entity_id: scene.kitchen_light_off
action: scene.turn_on
data: {}
- conditions:
- condition: trigger
id: kitchen-nomotion-detected
sequence:
- target:
entity_id: scene.kitchen_light_off
action: scene.turn_on
data: {}
mode: restart
The Challenge:
I’m unable to figure out how to track the initial trigger and set the corresponding auto-off timer. I’ve tried using trigger-ids and more conditions, but I haven’t been successful.
Additionally, I’m experiencing some issues with the automation’s responsiveness:
- Sometimes (it doesn’t happen every time), when the lights turn off automatically, they take a noticeable amount of time to turn back on when motion is detected again
Any advice on how to address this issue would be greatly appreciated.
Thanks in advance for your help!