Color Calibration in FLS-M Config-Builder NOT Reflected in Matter Device

To match the LEDs in my strip, I used Config-Builder to create two CT lights on the FLS-M (firmware version 1.1). Both with Advanced Light Options > Color Calibration > Warm White X, Y Position as 0.48614, 0.41467 (2,400K/417 mired) and Cool White X, Y Position as 0.31352. 0.32363 (6,500K/154 mired). However the color temperature range that appears in Apple Home via matter is 2,695K/371 mired to 6,535K/153 mired.

How do I get the FLS-M to advertise the color temperature range that matches my LED strips? I know it’s possible to do this with the ESP32-C6, because I’ve got an ESP-IDF Matter SDK project where I did this very thing. Thanks!

The FLS-M internally only uses CIE1931 xy chromaticity for all LED types. The possible CT range is based on the displayable color gamut.

The formula used for that is as follows:

void xy2mired(fixedPoint_t x, fixedPoint_t y, unsigned int *mired)
{
    // McCamy's approximation
    fixedPoint_t n = FIXEDPOINT_DIVIDE(
        FIXEDPOINT_SUBTRACT(x, FLOAT_TO_FIXEDPOINT(0.3320)),
        FIXEDPOINT_SUBTRACT(FLOAT_TO_FIXEDPOINT(0.1858), y)
    );
    fixedPoint_t nSquared = FIXEDPOINT_MULTIPLY(n, n);
    fixedPoint_t nCubed = FIXEDPOINT_MULTIPLY(nSquared, n);

    fixedPoint_t ct = // Scaled to 0K - 10000K -> 0.0 - 1.0
        FIXEDPOINT_ADD(
            FIXEDPOINT_ADD(
                FIXEDPOINT_ADD(
                    FIXEDPOINT_MULTIPLY(CONVERT_TO_FIXEDPOINT(437,0,10000), nCubed), 
                    FIXEDPOINT_MULTIPLY(CONVERT_TO_FIXEDPOINT(3601,0,10000), nSquared)
                ),
                FIXEDPOINT_MULTIPLY(CONVERT_TO_FIXEDPOINT(6861,0,10000), n)
            ), 
            CONVERT_TO_FIXEDPOINT(5517,0,10000)
        );

    // TODO: rework
    *mired = // Scaled to 0 - 1000 -> 0.0 - 1.0
        CONVERT_FROM_FIXEDPOINT(
            FIXEDPOINT_DIVIDE(
                FIXEDPOINT_ONE_VALUE, 
                FIXEDPOINT_MULTIPLY(ct, CONVERT_TO_FIXEDPOINT(10,0,1))
            ),
            0,
            1000
        );
}

Because the ESP32-C6 lacks a floating-point unit, we have to approximate with fixed-point math (in this case, 13-bit fractional depth). This leads to rounding errors, which are further amplified by the way mired is transformed into color temperature.

I’ll take a closer look at this for the next firmware release—it might make sense to add a dedicated color temperature field to the config builder.

Sorry for the inconvenience.

Explicit support for WW/CW strips would be greatly appreciated.

Using the ESP-IDF Matter SDK, if I create a Matter color temperature light with following snippet:

color_temperature_light::config_t light_config;
light_config.color_control_color_temperature.color_temp_physical_min_mireds = 154;
light_config.color_control_color_temperature.color_temp_physical_max_mireds = 417;

The range appears in Apple Home via Matter as 2,398K/415 mired to 6,493K/154 mired, which is a near perfect match for the LEDs in my strip.