Zigbee2mqtt: Hue Bulb Color Temp

Created on 23 Nov 2018  Â·  36Comments  Â·  Source: Koenkk/zigbee2mqtt

Request the color_temp parameter be converted internally from 0-454 to 0-100. My hue bulbs are expected the 0-454 range but that makes things difficult for a dimmer in openhab. Thanks

stale

Most helpful comment

Did you implement this?

{"color":{ "rgb_brightness": "255,0,0" }}

Also the new Hue app updates the hue bulbs so that when power returns they can be set to remain off, is that something that can be implemented?

All 36 comments

We need to somehow distinguish the mireds value (0-454) of the % value (0-100). Would it be possible to add an extra attribute to this message? Or provide the value as: {"color_temp": "80%"}?

I would say to add a variable similar to RGB and HSV, I was thinking that if a percentage is sent then it would just multiply it by 454 to not interfere with the established format. I don't know how to do this but it would make sense for it to recognize both a number and a percent and do the math internally before sending it on. Is that possible? Yes tacking on a "%" sign is easy enough in Openhab with the new MQTT 2.4 binding.

brightness and color_temp are now accepted in %, can you test this by checking out the dev branch?

How are you running zigbee2mqtt? (via https://github.com/Koenkk/zigbee2mqtt/wiki/Running-the-bridge ?)

I figured it out, what is the correct syntax for the message. I have tried
{
"color_temp": 0,
}
and
{
"color_temp": 0%,
}

I installed the dev branch and my Hue bulb would go online them immediately offline.

Percentage should be a string:

{
"color_temp": "50%"
}

For a color bulb is it possible to accept the format
{color: { rgb: "12,43,112" }}

Currently

{
  "color": {
    // RGB color
    "r": 46,
    "g": 102,
    "b": 193
  }
}

is supported, is this ok for you?

It works but requires a proxy item and rule to convert to a usable format. For openhab it would simplify things if it could accept either the format mentioned above or and HSB value.

This is supported know in the dev branch.

For domoticz and home assistant we have instructions on how to integrate with zigbee2mqtt.

Would you mind doing this for openhab? (https://github.com/Koenkk/zigbee2mqtt#integrations)

I could give it a shot, I will get to work and send you a preview when it is ready. I will test out the dev branch and let you know.


From: Koen Kanters notifications@github.com
Sent: Thursday, November 29, 2018 11:36 AM
To: Koenkk/zigbee2mqtt
Cc: jcf6288; Author
Subject: Re: [Koenkk/zigbee2mqtt] Hue Bulb Color Temp (#627)

This is supported know in the dev branch.

For domoticz and home assistant we have instructions on how to integrate with zigbee2mqtt.

Would you mind doing this for openhab? (https://github.com/Koenkk/zigbee2mqtt#integrations)

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/Koenkk/zigbee2mqtt/issues/627#issuecomment-442964804, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF8cFh9xFgDzqCBSEJMnhAf5g2UQtv4Gks5u0Dc1gaJpZM4YwmZl.

I set up a new instance of Zigbee2MQTT with the dev installed and my hue bulbs will show connected then go offline. I cycle power to them and they go online then immediately offline. Any ideas?

If I send a RGB such as {"color": {"r":25,"g":0,"b":0}} and the light is off, shouldn't it turn on to a brightness of 10?

No, that is only the case for brightness (because this is supported by ZCL, not for colortemp and color). To also turn it on send: {"state": "ON", "color": {"r":25,"g":0,"b":0}}

Understand all any ideas why I am having disconnect issues with the dev version?

Can you provide the log? (maybe zigbeem2qtt crashes)

I figured out the disconnect issue, it was my fault. Color Temp works great.
For color is this the correct format added?
{color: { rgb: "12,43,112" }}

yes, that format is supported.

The new format is working sort of, if I send
{"color":{ "rgb": "5,0,0" }} then {"color":{ "rgb": "255,0,0" }}
the output is the exact same, shouldn't the first be dimmer?

Can you provide the log?

I think this is due to the xy color conversion (not a bug), see: https://stackoverflow.com/questions/29834556/why-there-is-no-brown-or-grey-in-the-cie-xy-color-space

After playing with the dev for a few days is it possible to instead accept
{
"color_temp_percent": XX
}
{
"brightness_percent": XX
}

This would significantly improve and simplify the integration with openhab.

Supported in the dev branch.

Everything is working great, the last thing would be to accept an HSB value but that isn't necessary to make it work.

Why? Does openhab send both RGB and HSB values?

I can send either, with other bindings if you change the color with RGB the brightness follows so 255,0,0 would be 100 percent brightness on the red channel. 2.55,0,0 would be 1 percent brightness. The difference with Zigbee2MQTT is the user would have to send a brightness command then a color command unless there is a way to have Zigbee2MQTT interpret RGB with a Brightness value, if that makes sense.


From: Koen Kanters notifications@github.com
Sent: Friday, December 7, 2018 9:22 AM
To: Koenkk/zigbee2mqtt
Cc: jcf6288; Author
Subject: Re: [Koenkk/zigbee2mqtt] Hue Bulb Color Temp (#627)

Why? Does openhab send both RGB and HSB values?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/Koenkk/zigbee2mqtt/issues/627#issuecomment-445303499, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF8cFpdfIEu4IlTXQd7aYfJCF5IfCQrpks5u2qPPgaJpZM4YwmZl.

So after digging around I found this
`// sRGB luminance(Y) values
const double rY = 0.212655;
const double gY = 0.715158;
const double bY = 0.072187;

// Inverse of sRGB "gamma" function. (approx 2.2)
double inv_gam_sRGB(int ic) {
double c = ic/255.0;
if ( c <= 0.04045 )
return c/12.92;
else
return pow(((c+0.055)/(1.055)),2.4);
}

// sRGB "gamma" function (approx 2.2)
int gam_sRGB(double v) {
if(v<=0.0031308)
v = 12.92;
else
v = 1.055
pow(v,1.0/2.4)-0.055;
return int(v*255+0.5); // This is correct in C++. Other languages may not
// require +0.5
}

// GRAY VALUE ("brightness")
int gray(int r, int g, int b) {
return gam_sRGB(
rYinv_gam_sRGB(r) +
gY
inv_gam_sRGB(g) +
bY*inv_gam_sRGB(b)
);
}`

Would it be possible to send this
{"color":{ "rgb": "255,0,0" }}

have it calculate the brightness and send both in sequence? brightness_percent then color?

What about

{"color":{ "rgb_brightness": "255,0,0" }}

I don't want to change the current behaviour for all RGB commands.

That would work just fine


From: Koen Kanters notifications@github.com
Sent: Sunday, December 9, 2018 11:39 AM
To: Koenkk/zigbee2mqtt
Cc: jcf6288; Author
Subject: Re: [Koenkk/zigbee2mqtt] Hue Bulb Color Temp (#627)

What about

{"color":{ "rgb_brightness": "255,0,0" }}

I don't want to change the current behaviour for all RGB commands.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/Koenkk/zigbee2mqtt/issues/627#issuecomment-445565031, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AF8cFuoycOcTEsUTlNrdPfnmzzdxBm1sks5u3WbygaJpZM4YwmZl.

Did you implement this?

{"color":{ "rgb_brightness": "255,0,0" }}

Also the new Hue app updates the hue bulbs so that when power returns they can be set to remain off, is that something that can be implemented?

Not yet, could you perhaps make a pull request for adding the functions to https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/toZigbee.js

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings