When I try to send a turn_off message to a light that is already off, it blinks on momentarily before turning off. Is this expected? Easy to fix, but I’m surprised it’s necessary.
Context:
I have a pretty simple automation to manage a pair of lights. The payload for this question is this:
- action: light.turn_off
metadata: {}
target:
entity_id:
- light.her_bedside
- light.his_bedside
data: {}
…which (if my light is already on) causes it to blink on before turning off. Wut?
The truth table for what I’m trying to achieve is pretty simple:
…which basically says “if you double click your bedside, both lights will end up in the opposite state of the opposite one.” (eg. if I single click the button, my light turns off; if I then double click when hers is on, I want hers to turn off but not affect mine.0)
So the full resulting automation is this (note that I created this through the UI, just showing the YAML here for concision/completeness):
alias: bedside (his) - double click
description: ""
triggers:
- device_id: cc6647d1732ff02fd85cabbe614dfd2a
domain: zha
type: remote_button_double_press
subtype: button
trigger: device
conditions: []
actions:
- type: toggle
device_id: 42f49ef3f39ed87fa343573b0a8f59b7
entity_id: 1320fffb43914d7e3df3bd24a4888b80
domain: light
- if:
- condition: state
entity_id: light.her_bedside
state:
- "off"
then:
- action: light.turn_on
metadata: {}
target:
entity_id:
- light.her_bedside
- light.his_bedside
data: {}
else:
- action: light.turn_off
metadata: {}
target:
entity_id:
- light.his_bedside
- light.her_bedside
data: {}
mode: single
I expected the HA system to recognize that the light was already off and suppress the message, but if it did send the message I expected the light to ignore it, so this was pretty surprising. The manual fix is obvious, but I thought I’d ask before injecting the more complex logic. Anybody have thoughts for what is causing this behavior?
