Hi, I think I may have found a bug with the light services used in the automation configs in 2022.9.7. Or not. Can I please have some help? I think that the light.turn_off service isn’t interacting with my zigbee lights correctly because automations don’t work whereas manual dashboard control does.
Devices:
- Philips Hue Bridge V2.0
- Philips Hue Zigbee Downlights
Both automations (configs below) turn on the lights when motion is detected, and off when there is no motion detected. But the automations don’t actually turn the lights off even though the HA dashboard and Philips Hue app think they do. The steps and results are as follows.
- Start with the lights off.
- Wave hand in front of both motion sensors.
- The lights turn on.
- The HA dashboard shows the lights turning on.
- The Philips Hue app also shows the lights turning on.
- Wait for the motion sensors to change their states to “clear” and then wait the delay time set by the automations.
- The lights stay on.
- But HA incorrectly shows the lights as off.
- And Philips Hue also incorrectly show the lights as off.
The reason I think there’s a problem with the light services in the automations is because this problem doesn’t occur with manual state changes. From both HA and the Philips Hue app, I can very reliably toggle the lights on and off with the virtual switches in their dashboards. And when I do that through one, the other updates its dashboard to reflect the light state changes with a <1s delay.
Have I found a bug? Or have I done something wrong?
The lights are clearly still on.
But HA thinks the automation successfully turned them off.
And Philips Hue agrees.
This automation uses the west light and motion sensor.
alias: Motion Nightlight - Hall 2 W
description: Motion Nightlight - Hall 2 W
trigger:
- platform: state
entity_id:
- binary_sensor.hall_2_motion_w_motion
from: "off"
to: "on"
condition: []
action:
- alias: Turn on the lights
service: light.turn_on
data:
brightness_pct: 20
target:
entity_id: light.bedroom_3_light_w
- alias: Wait until there is no motion
wait_for_trigger:
- platform: state
entity_id:
- binary_sensor.hall_2_motion_w_motion
from: "on"
to: "off"
- alias: Wait the number of seconds that has been set
delay:
seconds: 5
- alias: Turn off the lights
service: light.turn_off
data: {}
target:
entity_id: light.bedroom_3_light_w
mode: single
max_exceeded: silent
This automation uses the east light and motion sensor.
alias: Motion Nightlight - Hall 2 E
description: Motion Nightlight - Hall 2 E
trigger:
- platform: state
entity_id: binary_sensor.hall_2_motion_e_motion
from:
- "off"
- "on"
to:
- "on"
- "off"
condition: []
action:
- if:
- condition: template
value_template: "{{ trigger.to_state.state == 'on' }}"
then:
- alias: Turn on the light when motion is detected
service: light.turn_on
data:
brightness_pct: 20
target:
entity_id: light.bedroom_3_light_e
else:
- alias: Wait a number of seconds after no motion is detected
delay:
seconds: 1
- alias: Turn off the light if no motion is detected
service: light.turn_off
data: {}
target:
entity_id: light.bedroom_3_light_e
mode: single
max_exceeded: silent
Thank you to 123 Taras for writing that last config.
1 post - 1 participant