Interface AdaptiveLightingTransitionCurveEntry

interface AdaptiveLightingTransitionCurveEntry {
    brightnessAdjustmentFactor: number;
    duration?: number;
    temperature: number;
    transitionTime: number;
}

Properties

brightnessAdjustmentFactor: number

The color temperature actually set to the color temperature characteristic is dependent on the current brightness value of the lightbulb. This means you will always need to query the current brightness when updating the color temperature for the next transition step. Additionally you will also need to correct the color temperature when the end user changes the brightness of the Lightbulb.

The brightnessAdjustmentFactor is always a negative floating point value.

To calculate the resulting color temperature you will need to do the following.

In short: temperature + brightnessAdjustmentFactor * currentBrightness

Complete example:

const temperature = ...; // next transition value, the above property
// below query the current brightness while staying the the min/max brightness range (typically between 10-100 percent)
const currentBrightness = Math.max(minBrightnessValue, Math.min(maxBrightnessValue, CHARACTERISTIC_BRIGHTNESS_VALUE));

// as both temperature and brightnessAdjustmentFactor are floating point values it is advised to round to the next integer
const resultTemperature = Math.round(temperature + brightnessAdjustmentFactor * currentBrightness);
duration?: number

The duration in milliseconds this exact temperature value stays the same. When we transition to to the temperature value represented by this entry, it stays for the specified duration on the exact same value (with respect to brightness adjustment) until we transition to the next entry (see transitionTime).

temperature: number

The color temperature in mired.

transitionTime: number

The time in milliseconds the color temperature should transition from the previous entry to this one. For example if we got the two values A and B, with A.temperature = 300 and B.temperature = 400 and for the current time we are at temperature value 300. Then we need to transition smoothly within the B.transitionTime to the B.temperature value. If this is the first entry in the Curve (this value is probably zero) and is the offset to the transitionStartMillis (the Date/Time were this transition curve was set up).