-
-
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
[deconz] Hue/Saturation Conversions incorrect. #11031
Comments
The binding used the openhab-core methods for converting hsb to xy (as does the hue binding). I'm not an expert on these color things, but it seems there are different colorspaces which need different conversions: https://community.openhab.org/t/solved-convert-hsbtype-to-cie-xy-needed-for-ikea-tradfri-control-through-deconz-rest/48825/12 |
The observed behavior might be caused by a similar reason like described in #10159 for IKEA CWS bulbs controlled by hue binding. Currently if a bulb is in CT color mode the binding will send hue/sat/bri values which are not applicable for IKEA bulbs. This happens because we only send xy/bri values if the current color mode is XY. Thus we changed the default behavior of the hue binding to preferr XY values over HSB unless a Bild is in HS color mode (see #10608). |
Thanks @J-N-K and @cweitkamp, From Lines 213 to 225 in 487dc0e
I'm not confident that it will solve this particular problem, in the test case above As @J-N-K said, the actual conversion happens in openhab-core for a specific gamma "compression", but wouldn't this mean that I would experience the same behavior if I were to use the Hue bridge and binding, then use the same rule to set the light red? I can try this if necessary. A Hue application note for XY Color conversion uses different matrix coeficients than: openhab-core's implementation. Which uses the same values as found in https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation_(sRGB_to_CIE_XYZ). |
Yes, I think so. I proposed #11036 I agree on that this PR will not solve your issue. Reading the linked pages I came to the following thoughts. First we need a way to use different matrix coefficients to convert RGB values to XY. This can be done in OHC by extending the Gamut A
Gamut B
Gamut C
A quick check on my Hue API shows me that we get the supported color gamut type and the color gamut specification itself in the response. Something like this: ...
"colorgamuttype": "C",
"colorgamut": [
[
0.6915,
0.3083
],
[
0.1700,
0.7000
],
[
0.1532,
0.0475
]
],
... Unfortunately those are not available on deCONZ REST API. |
I'll check with the deconz Team if the API can be extended. |
Thanks again @cweitkamp and @J-N-K,
Sounds good to me, being able to select the appropriate matrix manually in the thing's configuration would be a good first implementation, shall I create an issue on OHC? |
Expected Behavior
Updating a new Hue light (with the latest firmware) with the following command:
Should turn the Hue colorbulbs to red with full saturation at 33% brightness and the deconz rest API should return:
Current Behavior
The openHAB logs acknowledge the correct value being set in openHAB which is percent type saturation and brightness:
However the bulb is visibly less saturated and at a different hue than it should be. The deCONZ API reports:
Note that
state.hue
,state.sat
andstate.xy
are quite a way out. If the colour is changed via Hue bluetooth or through the deconz app, the blub shows the correct colour and openHAB reports the same three values for HSB (i.e.0,100,33
)Possible Solution
It looks like openHAB isn't converting between HSB and the values required by the deconz API. Hue should convert from 0-360 to 0-65535 and saturation should covert from 0-100 to 0-255
Steps to Reproduce (for Bugs)
/api/<API_KEY>/lights/<light_ID>
)Context
This happens with all my colour lights, all of which are Extended Colour Phillips Hue of different types (strip lights or standard bulbs) but with the latest firmware.
Your Environment
The text was updated successfully, but these errors were encountered: