Open djurny opened 4 months ago
Workaround based on this comment: Add an mqtt.publish
message to enable execute_if_off
and mqtt.publish
a message to set the color_temp
wanted before the light is turned on.
//snip
- repeat:
for_each: '{{ state_attr(entity_light, "entity_id") }}'
sequence:
- service: mqtt.publish
data_template:
topic: 'zigbee2mqtt/{{state_attr(repeat.item, "friendly_name")}}/set/color_options'
payload: |
{
"execute_if_off": "true"
}
- service: mqtt.publish
data_template:
topic: 'zigbee2mqtt/{{state_attr(repeat.item, "friendly_name")}}/set'
payload: |
{
"color_temp": "{{turn_on_quirk_color_temp_mired_current}}",
"transition": "0"
}
//snip
This workaround will only work when using Zigbee lights + zigbee2mqtt. In my case, the Philips Hue and Ikea bulbs luckily support the execute_if_off
feature for setting the color temperature.
Related issues:
Please confirm that you have completed the following steps:
Required information for bug reports:
Please include the following information in your issue.
Issues missing this information may not be addressed.
Zigbee2MQTT:
Homeassistant:
In short: it seems that
adaptive_lighting.apply
withturn_on_lights = false
does not actually send any commands to (in my case) Zigbee2MQTT in case the bulb is OFF. Some more elaboration: I would like to set the color temperature of (Ikea) bulbs that are off, before turning the bulb on. Normal case is that the Ikea bulb will adjust brightness before color temperature. A workaround I wanted to implement is to set the color temperature first (when bulb is off), beforeadaptive_lighting.apply
'ing withadapt_brightness = true
+turn_on_lights = true
to turn on the bulb(s). My attempt was to do aadaptive_lighting.apply
withadapt_color = true
+adapt_brightness = false
+turn_on_lights = false
, but this does not seem to change the color temperature of the bulb. The Z2M logging also does not show that there is a message being sent to the bulb when the service is called with those attributes.Observed behavior/effect: Use Z2M frontend to change color temperature to warmest. Use Z2M frontend or HASS to turn off bulb. Call
adaptive_lighting.apply
as follows to change color temperature while bulb is OFF: Calladaptive_lighting.apply
as follows to turn on the bulb w/out color temperature change Bulb does not change color temperature back to what adaptive lighting should have set it to. Also, there is no Z2M activity observed for the firstadaptive_lighting.apply
that would set color temperature while bulb is off, only for the secondadaptive_lighting.apply
messages to the bulb are observed. Expected behavior/effect: Zigbee2MQTT has exposed "Color options - Execute if off". This option allows to set the color temperature to the bulb in case it's off. Using the Z2M frontend, this seems to be exactly what the option is enabling:Note that "state" is set to "OFF" in the Zigbee message here and when the bulb is turned on there is no color temperature transition occurring.