I’ve just been experimenting with an automation to turn on a light with 1 brightness and flash. What I’ve noticed is this behaviour changes when the light is on to when the light is off.
- service: light.turn_on
data:
entity_id: light.my_light
flash: short
brightness: 1
If I send this while the light is on set to 230 brightness the light will go to 1 then flash and return to 1. (As expected).
If I send this while the light is off it will finish on full brightness but be set to 1 brightness in home assistant. (unexpected)
I’m using Zigbee2MQTT and an Ikea Tradfri bulb so I’m not sure if this is a limitation of the bulb, a bug with Z2M or HA. I’m guessing it’s a combination of those factors as a Hue bulb doesn’t do this, it will return to the brightness set no matter what state it’s in.
EDIT: the weirdest thing, if I run this in an automation instead of the dev console, the brightness remains on full even with the light on set to 1 brightness
I’ve done some more investigation into this and I’m honestly baffled at the different behaviour here. Although I think this is looking like a bug in Zigbee2MQTT or even with the IKEA bulb.
Here are the two procedures, with corresponding mqtt commands on the set topic, that should be identical but give different results:
Light is turned off was on at 255 brightness.
As the slider is already on 1 it won’t turn it on moving it so just switch it on {"state": "ON"}
Set brightness to 1 {"state": "ON", "brightness": 1}.
Select “okay” effect (similar to flash) on the drop down in lovelace {"state": "ON", "effect": "okay"}
Light will flash twice and return to brightness 1.
Try the same but in dev console:
Light turned off with 255 brightness in lovelace for ease
Turn light on and set brightness to 1 {"state": "ON", "brightness": 1}.
Light will flash twice and report 1 brightness in HA but in reality it’s at what seems full brightness.
Interestingly doing zb2mqtt/Light Landing/get Z2M reports it’s at 1 too:
If I do the same but set the brightness to 2 it works as expected after the effect. I think it may be something to do with how the bulb handles brightness 1, I seem to remember some bulbs handling this as off and Z2M doing a workaround.
A workaround would be to first off set the bulb on at anything above one or just on (as in how it works in lovelace) and then change down to 1. Mind you 2 is unnoticeable so I’ll just use that for now.