Skip to content
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

Colour Temperature Revisited... Again #814

Closed
ebaauw opened this issue Nov 14, 2020 · 12 comments
Closed

Colour Temperature Revisited... Again #814

ebaauw opened this issue Nov 14, 2020 · 12 comments

Comments

@ebaauw
Copy link
Owner

ebaauw commented Nov 14, 2020

With the introduction of Adaptive Lighting (see #766) in iOS14, Apple has once again changed how the Home app deals with colour temperature. To cope with this change, Homebridge Hue will be implementing the following, possibly breaking, changes handling colour temperature:

  1. Homebridge Hue no longer uses the custom Color Temperature characteristic. Instead it uses the standard Color Temperarure characteristic for Etended Color Light as well as for Color Temperature Light devices types;
  2. When setting Color Temperature from HomeKit, Homebridge Hue will set ct on the Hue bridge. When successful, Homebridge Hue updates the Hue and Saturation values in HomeKit by converting ct into xy.

Ad 1.
Apple's Home app now supports Lightbulb services which expose both Hue / Saturation and ColorTemperature. So the workaround in Homebridge Hue, to expose ct using the custom ColorTemperature characteristic in Eve, is no longer needed. You can now set the CCT channel of RGB+CCT lights and controllers from Home, by changing the Temperature wheel. Home is still a bit "jumpy", but it no longer jumps to the Color wheel. The same happens when using the native HomeKit function of the gen-2 Hue bridge, so please send your complaints to Apple.

If you used HomeKit scenes (created in Eve) to set the CCT channels of RGB+CTT lights from Home before, those scenes will become empty, as the custom Color Temperature characteristic is no longer exposed.

Ad 2.
As far as I can tell from testing, the Hue bridge updates Hue and Saturation after changing Color Temperature when it next polls the light. We know Hue lights translate the ct value to the corresponding xy values in their firmware, but as far as I know, other lights don't. Also, with many lights in your Zigbee network, the polling takes longer, causing the updated colour to appear late.

Homebridge Hue now translates the ct value to the corresponding xy value. It uses the algorithm from the deCONZ REST API plugin for this, and then uses the existing translation from xy to Hue / Saturation (still using the algorithm from the Hue developers portal). When selecting a colour temperature in the Temperature wheel, the dot will briefly show the colour temperature, and then change to the Hue / Saturation colour. Again, this is the same behaviour as when using the native HomeKit feature of the Hue bridge, so please complain to Apple.

Colour is a bitch. The involved math in the colour transformations is beyond me. The translation from ct to xy might yield slightly different results than the Hue light firmware. Consequently, the Hue and Saturation values might still change slightly, when the light is next polled. This is no different from lights reporting slightly different xy values from what was set, combined with minor differences translating Hue / Saturation to xy and back.

@ebaauw ebaauw pinned this issue Nov 14, 2020
ebaauw added a commit that referenced this issue Nov 14, 2020
- Changes to handling colour temperature, see #814.
- First step towards implemening adaptive lighting, for now only for Hue LCT015.
@llamafilm
Copy link

You can now set the CCT channel of RGB+CCT lights and controllers from Home, by changing the Temperature wheel.

Is this a beta feature? On iOS 14.2 I am still unable to do this with Gledopto lights. The temperature wheel sets an approximate white using the RGB diodes, but there is no way to control the white diodes. It works fine in Eve though.

For non-Hue lights like Gledopto, will you continue to set ct directly? No need for translation there.

@ebaauw
Copy link
Owner Author

ebaauw commented Nov 17, 2020

You need to use the latest Homebridge Hue beta. I think Apple introduced adaptive lighting in iOS 14, but I’m not sure. I’m running 14.2.

@llamafilm
Copy link

I updated to v0.12.1-3 beta, no dice. I always thought this was a bug with the Home app, but you're saying this is working for you now? Even if I set a shade of white using Eve, next time I adjust the color temp wheel in Home app it changes back to RGB-mixed white.

@ebaauw
Copy link
Owner Author

ebaauw commented Nov 18, 2020

Double-checked on my 1ID GLEDOPTO GL-C-008: setting the colour temperature from the Temperature wheel in Home now drives the CCT channels. However, Home (and Eve) revert to showing the (old) RGB colour (while the controller continues to drive the CCT channels).

Neither Home nor Eve display the Color Temperature, they only display the colour based on Hue and Saturation, which are set from xy. The issue with the GLEDOPTO is, that, unlike Hue lights, it doesn't update xy when setting ct. So when Homebridge Hue next polls the light, it reports the old RGB colour, overwriting the computed xy values by Homebridge Hue, when setting ct. I should probably ignore xy for non-Hue lights in ct colormode.

@llamafilm
Copy link

Now on v0.12.1-5 this seems to be working. Maybe I just forgot to restart after the last update. Home app prompted me to set up adaptive lighting. It's hard to tell if it's actually adjusting or not, I have to monitor it for several hours I guess. Eve does show the color temp separate from color with the one Gledopto 1ID I have.

@ebaauw
Copy link
Owner Author

ebaauw commented Nov 18, 2020

It's hard to tell if it's actually adjusting or not

Try changing the brightness and see how the temperature changes accordingly.

Eve does show the color temp separate from color with the one Gledopto 1ID I have.

What do you mean? Could you post a screenshot?

ebaauw added a commit that referenced this issue Nov 19, 2020
- Expose Hue lights under manufacturer "Signify Netherlands B.V.";
- Only consider `xy` in `ct` colormode, for Hue and dresden elektronik lights that actually compute `xy` when setting `ct`, see #814.
@ebaauw
Copy link
Owner Author

ebaauw commented Nov 19, 2020

Please try beta v0.12.1-8.

@Zer0x00
Copy link

Zer0x00 commented Nov 19, 2020

Apple's Home app now supports Lightbulb services which expose both Hue / Saturation and ColorTemperature.

@ebaauw Where did you get this info from? I couldn't find any info about this.
Or is this just based on your experience?

@ebaauw
Copy link
Owner Author

ebaauw commented Nov 19, 2020

Checking how the Hue bridge with the latest firmware with Adaptive Lighting support exposes the Enhanced Color Light bulbs. Supereg had also already found this for the Eve lightstrip.

@llamafilm
Copy link

Try changing the brightness and see how the temperature changes accordingly.

Okay, I see what you mean. This is pretty cool.

Eve does show the color temp separate from color with the one Gledopto 1ID I have.

What do you mean? Could you post a screenshot?

I posted a screenshot of this before in #810 showing separate parameters for color and color temp. But now in the latest beta it's different. Color temp has been removed, and there is a new parameter called config, I don't know what that's for.

This all seems to be working so far, but I notice something odd in the log. Every time I change brightness, it changes the color temp (good). But then it also changes the hue / sat. It does not actually send this change to the light, I just see it in the log.

[11/22/2020, 12:22:40 AM] [Hue] 6: homekit brightness changed from 50% to 100%
[11/22/2020, 12:22:40 AM] [Hue] 6: homekit adaptive lighting color temperature changed from 432 mired to 351 mired
[11/22/2020, 12:22:40 AM] [Hue] 6: set homekit hue from 37˚ to 39˚
[11/22/2020, 12:22:40 AM] [Hue] 6: set homekit saturation from 64% to 50%

@ebaauw
Copy link
Owner Author

ebaauw commented Nov 22, 2020

No, it sends it to HomeKit (that’s what “set homekit ... to” means). Color Temperature is write-only, only used to set ct from HomeKit. HomeKit only displays the colour from Hue and Saturation. It expects the light to update these after setting Color Temperature.

there is a new parameter called config, I don't know what that's for.

That’s Configured Name, used to sync the HomeKit service name to the Hue bridge resource name, see #793.

@ebaauw
Copy link
Owner Author

ebaauw commented Nov 22, 2020

In v0.12.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants