Bug v4.118 (Smart Lighting): f.lux sets wrong color temp (2200K) for some Hue bulbs when temp ≥6500K



  • Hi,

    I have two types of Philips Hue smart bulbs in my computer room: Color Ambiance and White Ambiance.

    There’s an issue where, above a certain threshold, f.lux sets my White Ambiance bulbs to 2200K (warmest setting) instead of the correct temp. This happens for temperatures ≥6500K with the “match screen exactly” option, and ≥9200K with the “slightly warmer” option.

    The Color Ambiance bulbs don’t appear to exhibit any issue that's visible to the naked eye. But querying the Hue API debugger reveals unexpected values at 6500K with the “match screen exactly” option, and at 9200K with the “slightly warmer” option.

    Obviously, 9200K is not such a big deal, but 6500K happens to be the standard “daylight” temperature, the D65 white point, and the default setting for f.lux and for most computer displays. It’s way more problematic.

    Technical info: (see https://developers.meethue.com/develop/get-started-2/)

    • The Color Ambiance bulbs have a color gamut delimited by the following xy chromaticity coordinates: [[0.6915, 0.3083], [0.17, 0.7], [0.1532, 0.0475]];
    • Those bulbs can also operate directly in color temperature (ct) mode for temperatures from 153 to 500 mireks, approx. 6540K to 2000K;
    • The White Ambiance bulbs only operate in ct mode, with a temperature range of 153 to 454 mireks, approx. 6540K to 2200K;
    • To convert color temperature from kelvins to mireks and back, the formula is M = 1E6/T;
    • Trying to set a value that’s out-of-range in ct mode will default to the nearest in-range value:
      • e.g., trying to set {"ct": 108} (≈9260K) will actually set {"ct": 153} (≈6540K);
    • This is true even for Color Ambiance bulbs. However, those can be set to warmer or cooler temperatures that fall outside of their ct range using xy mode and some fancy math (or lookup tables):
      • e.g., for 1900K, one could set those bulbs to {"xy": [0.5378, 0.4112]} because {"ct": 526} would instead set them to {"ct": 500}, i.e., 2000K;
    • There is not hard limit on values in xy mode for Color Ambiance bulbs. They accept just about any xy chromaticity coordinates, even if out of gamut, in which case their color may be close but inaccurate;

    Expected f.lux behavior:

    Based on the information above, if the target Hue bulb is a Color Ambiance bulb (i.e., ct and xy color modes), f.lux should first compute the temperature in mireks (M = 1E6/T). If the result falls within the ct range of the bulb (in my case, between 153 and 500), f.lux should set the bulb to that value in ct mode. If it falls outside of that range, f.lux should compute xy chromaticity coordinates for that temperature (or use lookup tables), and set the bulb to those coordinates in xy mode.

    However, if the target Hue bulb is a White Ambiance bulb (i.e., ct color mode only), I’d expect f.lux to compute the temperature in mireks (M = 1E6/T) and try set the bulb to that value in ct mode, even if out of range. In theory, if the value is out of range, the bulb should default to the nearest valid temperature.

    Actual f.lux behavior: (with the “match screen exactly” option)

    • 1200K: 1E6/1200 ≈ 833 mireks, which falls outside the ct range of both bulbs.
      • As expected, the Color Ambiance bulbs are set to {"xy": [0.6206, 0.3615]} ≈ 1193K (according to Python’s colour-science module).
      • As expected, the White Ambiance bulbs are set to {"ct": 454} (nearest in-range value).
    • 2100K: 1E6/2100 ≈ 476 mireks, which falls inside the ct range of the Color Ambiance bulbs, but outside that of the White Ambiance bulbs.
      • As expected, the Color Ambiance bulbs are set to {"ct": 476} (exact value).
      • As expected, the White Ambiance bulbs are set to {"ct": 454} (nearest in-range value).
    • 4300K: 1E6/4300 ≈ 233 mireks, which falls inside the ct range of both bulbs.
      • As expected, both the Color and White Ambiance bulbs are set to {"ct": 233}.
    • 6500K (buggy): 1E6/5000 ≈ 154 mireks, which falls inside the ct range of both bulbs. One would expect both bulbs to be set to {"ct": 154}. However, neither are!
      • The Color Ambiance bulbs are set to {"xy": [0.3135, 0.3236]} ≈ 6502K (according to Python’s colour-science module). This is not necessarily wrong, but unexpected... Why assign an xy value manually when the hardware can handle the color temperature directly?
      • The White Ambiance bulbs are set to {"ct": 454}, which is very wrong: 1E6/454 ≈ 2200K, their warmest color temperature, and nowhere near 6500K.
    • 9300K (buggy): 1E6/9300 ≈ 108 mireks, which falls outside the ct range of both bulbs.
      • As expected, the Color Ambiance bulbs are set to {"xy": [0.6206, 0.3615]} ≈ 9297K (according to Python’s colour-science module).
      • However, as with any temperature ≥6500K, the White Ambiance bulbs are set to {"ct": 454}, which is very wrong: 1E6/454 ≈ 2200K, their warmest color temperature, and nowhere near 9300K.

    Conclusion:

    For color temperatures ≥6500K, f.lux sets Hue smart bulbs to wrong or unexpected values. It appears as if f.lux didn't query the API correctly to determine the specifications of each bulb. If f.lux uses lookup tables to convert color temperatures to xy and ct values, there could also be a problem with those LUTs.

    Since 6500K is the default daylight color in f.lux, the issue is mitigated by setting the lighting color to “slightly warmer” or “quite a bit warmer (default)”, since that prevents the bulb temperature from crossing that threshold under normal circumstances. The bug may have gone unnoticed until now because not everyone has Philips Hue lighting, and it is most obvious when the lighting color is set to “match screen exactly”.



  • Additional debug info:

    NVIDIA 27.21.14.5206: NVIDIA GeForce GTX 1070 Ti (20200812)
    
    LEN L24q-30, 527 x 296mm, built 2020
    Chromaticities: 
      R=0.663086 0.327148
      G=0.272461 0.627930
      B=0.147461 0.051758
      W=0.313477 0.329102
      sRGB gamut: 100%, AdobeRGB gamut: 75%
    
    Winlimit=0, 0
    Monitor 1 on NVIDIA GeForce GTX 1070 Ti: VCGT=0 gamma=1
    
    Windows Build: 19041.508
    
    {
      "1": {
        "state": {
          "on": true,
          "bri": 226,
          "hue": 42104,
          "sat": 76,
          "effect": "none",
          "xy": [
            0.3136,
            0.3237
          ],
          "ct": 153,
          "alert": "select",
          "colormode": "xy",
          "mode": "homeautomation",
          "reachable": true
        },
        "swupdate": {
          "state": "noupdates",
          "lastinstall": "2020-03-10T12:00:00"
        },
        "type": "Extended color light",
        "name": "Bedroom 1",
        "modelid": "LCT016",
        "manufacturername": "Signify Netherlands B.V.",
        "productname": "Hue color lamp",
        "capabilities": {
          "certified": true,
          "control": {
            "mindimlevel": 1000,
            "maxlumen": 800,
            "colorgamuttype": "C",
            "colorgamut": [
              [
                0.6915,
                0.3083
              ],
              [
                0.17,
                0.7
              ],
              [
                0.1532,
                0.0475
              ]
            ],
            "ct": {
              "min": 153,
              "max": 500
            }
          },
          "streaming": {
            "renderer": true,
            "proxy": true
          }
        },
        "config": {
          "archetype": "sultanbulb",
          "function": "mixed",
          "direction": "omnidirectional",
          "startup": {
            "mode": "powerfail",
            "configured": true
          }
        },
        "uniqueid": "xx:xx:xx:xx:xx:xx:xx:xx-xx",
        "swversion": "1.50.2_r30933",
        "swconfigid": "B8000037",
        "productid": "Philips-LCT016-1-A19ECLv5"
      },
      "2": {
        "state": {
          "on": true,
          "bri": 226,
          "hue": 42104,
          "sat": 76,
          "effect": "none",
          "xy": [
            0.3136,
            0.3237
          ],
          "ct": 153,
          "alert": "select",
          "colormode": "xy",
          "mode": "homeautomation",
          "reachable": true
        },
        "swupdate": {
          "state": "noupdates",
          "lastinstall": "2020-03-10T12:00:00"
        },
        "type": "Extended color light",
        "name": "Bedroom 2",
        "modelid": "LCT016",
        "manufacturername": "Signify Netherlands B.V.",
        "productname": "Hue color lamp",
        "capabilities": {
          "certified": true,
          "control": {
            "mindimlevel": 1000,
            "maxlumen": 800,
            "colorgamuttype": "C",
            "colorgamut": [
              [
                0.6915,
                0.3083
              ],
              [
                0.17,
                0.7
              ],
              [
                0.1532,
                0.0475
              ]
            ],
            "ct": {
              "min": 153,
              "max": 500
            }
          },
          "streaming": {
            "renderer": true,
            "proxy": true
          }
        },
        "config": {
          "archetype": "sultanbulb",
          "function": "mixed",
          "direction": "omnidirectional",
          "startup": {
            "mode": "powerfail",
            "configured": true
          }
        },
        "uniqueid": "xx:xx:xx:xx:xx:xx:xx:xx-xx",
        "swversion": "1.50.2_r30933",
        "swconfigid": "B8000037",
        "productid": "Philips-LCT016-1-A19ECLv5"
      },
      "3": {
        "state": {
          "on": true,
          "bri": 226,
          "hue": 42104,
          "sat": 76,
          "effect": "none",
          "xy": [
            0.3136,
            0.3237
          ],
          "ct": 153,
          "alert": "select",
          "colormode": "xy",
          "mode": "homeautomation",
          "reachable": true
        },
        "swupdate": {
          "state": "noupdates",
          "lastinstall": "2020-03-10T12:00:00"
        },
        "type": "Extended color light",
        "name": "Bedroom 3",
        "modelid": "LCT016",
        "manufacturername": "Signify Netherlands B.V.",
        "productname": "Hue color lamp",
        "capabilities": {
          "certified": true,
          "control": {
            "mindimlevel": 1000,
            "maxlumen": 800,
            "colorgamuttype": "C",
            "colorgamut": [
              [
                0.6915,
                0.3083
              ],
              [
                0.17,
                0.7
              ],
              [
                0.1532,
                0.0475
              ]
            ],
            "ct": {
              "min": 153,
              "max": 500
            }
          },
          "streaming": {
            "renderer": true,
            "proxy": true
          }
        },
        "config": {
          "archetype": "sultanbulb",
          "function": "mixed",
          "direction": "omnidirectional",
          "startup": {
            "mode": "powerfail",
            "configured": true
          }
        },
        "uniqueid": "xx:xx:xx:xx:xx:xx:xx:xx-xx",
        "swversion": "1.50.2_r30933",
        "swconfigid": "B8000037",
        "productid": "Philips-LCT016-1-A19ECLv5"
      },
      "4": {
        "state": {
          "on": true,
          "bri": 226,
          "hue": 42104,
          "sat": 76,
          "effect": "none",
          "xy": [
            0.3135,
            0.3236
          ],
          "ct": 153,
          "alert": "select",
          "colormode": "xy",
          "mode": "homeautomation",
          "reachable": true
        },
        "swupdate": {
          "state": "noupdates",
          "lastinstall": "2020-03-10T12:00:00"
        },
        "type": "Extended color light",
        "name": "Bedroom 4",
        "modelid": "LCT016",
        "manufacturername": "Signify Netherlands B.V.",
        "productname": "Hue color lamp",
        "capabilities": {
          "certified": true,
          "control": {
            "mindimlevel": 1000,
            "maxlumen": 800,
            "colorgamuttype": "C",
            "colorgamut": [
              [
                0.6915,
                0.3083
              ],
              [
                0.17,
                0.7
              ],
              [
                0.1532,
                0.0475
              ]
            ],
            "ct": {
              "min": 153,
              "max": 500
            }
          },
          "streaming": {
            "renderer": true,
            "proxy": true
          }
        },
        "config": {
          "archetype": "sultanbulb",
          "function": "mixed",
          "direction": "omnidirectional",
          "startup": {
            "mode": "powerfail",
            "configured": true
          }
        },
        "uniqueid": "xx:xx:xx:xx:xx:xx:xx:xx-xx",
        "swversion": "1.50.2_r30933",
        "swconfigid": "B8000037",
        "productid": "Philips-LCT016-1-A19ECLv5"
      },
      "5": {
        "state": {
          "on": true,
          "bri": 226,
          "ct": 454,
          "alert": "none",
          "colormode": "ct",
          "mode": "homeautomation",
          "reachable": true
        },
        "swupdate": {
          "state": "noupdates",
          "lastinstall": "2020-03-10T12:00:00"
        },
        "type": "Color temperature light",
        "name": "Desk 1",
        "modelid": "LTW015",
        "manufacturername": "Signify Netherlands B.V.",
        "productname": "Hue ambiance lamp",
        "capabilities": {
          "certified": true,
          "control": {
            "mindimlevel": 1000,
            "maxlumen": 800,
            "ct": {
              "min": 153,
              "max": 454
            }
          },
          "streaming": {
            "renderer": false,
            "proxy": false
          }
        },
        "config": {
          "archetype": "flexiblelamp",
          "function": "functional",
          "direction": "omnidirectional",
          "startup": {
            "mode": "custom",
            "configured": true,
            "customsettings": {
              "bri": 254,
              "ct": 233
            }
          }
        },
        "uniqueid": "xx:xx:xx:xx:xx:xx:xx:xx-xx",
        "swversion": "1.50.2_r30933",
        "swconfigid": "72630961",
        "productid": "Philips-LTW015-1-A19CTv2"
      }
    }
    


  • Thanks we will take a look - the white ambiance bug seems pretty real.

    Also, min/max are newer in the API - we will try to use them also.


Log in to reply