-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mqtt.homassistant] changing color temperature switches on light #18188
Comments
fyi @ccutrer |
There are a few things here. The short answer is that it's working as expected. But first, while your linked comments indicate a preference for changing color temperature to not turn on a bulb, it's not a strict guideline for openHAB bindings. The documentation mentions color temperature, but not if it's expected that send a command to a color temperature channel should turn on the bulb, or leave the on state alone. Second, specific to the Home Assistant binding, we're somewhat limited in that we have to live within the confines of how Home Assistant works, especially since 99% of Home Assistant MQTT compatible devices are only tested with Home Assistant, not openHAB. And Home Assistant itself does not support sending color_temp without also sending "ON". See the source. As such, it would be a toss up on how any particular device would respond to any given message. And in general in this binding, I try to follow Home Assistant's semantics as much as it makes sense within openHAB. Which brings us to our final point... Zigbee2MQTT, at least with the Hue bulb you mention, does not support setting color temp while the bulb is off. Try it yourself directly with MQTT - send the following commands to your bulb with something like MQTT Explorer:
The bulb will come back on at the warmest color temp. You can also attempt these steps in Zigbee2MQTT's own UI, with the same results. Which is a sad state of affairs. I'd love to change the color temp of my Hue bulbs while they're off as much as you (my wife gets really ornery when she notices them turn on in the morning and immediately transition from warm white that they were the prior night to cool white for daytime, and it seems like they pass through a pinkish hue). I know that Hue bulbs are capable of doing this when using the Hue openHAB binding and a native Hue bridge, but zigbee2mqtt doesn't expose this functionality. It's been discussed in the past, but I guess enabling it for Hue bulbs broke some other brands? I hope to try to send some lower level zigbee commands to get it to work, but haven't had time to do so. And even if it is, it would be out of scope for this binding. |
Thanks for this detailed explanation. I already tried the examples you proposed and can confirm what you described. In my opinion this is still better than switching the light on. Previously, I was using deconz. I was setting the color temperature of all lights periodically (I guess for the same reason as you do - to adjust it to the current daylight temperature). I somehow assumed that basically moving the same 'thing' to a different binding would not change the behaviour but I can see that both implementations are compliant. I guess I have to accept that the behaviour is different now and will rewrite my rule to update only the color temperature of already switched on lights. As this was one of the first things I automated with openhab it's probably a good idea anyway to get rid of this fragile piece of code. |
Yup, that's exactly what I have to do. My rule (in Ruby): def cct_range(item)
item.range || ((2000 | "K")..(6500 | "K"))
end
changed Circadian_ColorTemp do |event|
next unless event.state?
gCircadian.members.each do |cct_item|
switch_item = cct_item.equipment.points(Semantics::Switch).first
next unless switch_item.on?
target = event.state.clamp(cct_range(cct_item)) | "mired"
current = cct_item.state&.|("mired")
cct_item.command!(target) if !current || (target.to_f - current.to_f).abs > 2
end
end I have a single item Anyhow, I'll close this issue now. |
Expected Behavior
I have a hue white ambiance bulb connected via zigbee2mqtt. When the bulb is switched off and I change the color temperature, I expect that the bulb stays switched off.
Current Behavior
When changing the color temperature, the bulb is switched on.
The following message is published to mqtt
zigbee2mqtt/Osram Lampe 1/set
:Possible Solution
Do not set the state at all in
handleColorTempCommand
openhab-addons/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/component/JSONSchemaLight.java
Line 224 in 09cf1b1
If
was sent to mqtt, the color temperature is set but the bulb stays off.
I did not actually try the modified code; before setting up a dev environment, I wanted to make sure that the current behaviour is actually not intended and that there are no side effects I did not think of.
Steps to Reproduce (for Bugs)
Context
Previously, the bulb was connected via deconz. Here, the bulb stays switched off when changing the color temperature. According to #9700 (comment) this should be the expected behaviour.
Your Environment
The text was updated successfully, but these errors were encountered: