cap:color:temperature
- light supports temperature¶
Capability used to mark lights that support setting color temperature natively.
if(thing.matches('cap:color:temperature')) {
console.log('Range is', thing.colorTemperatureRange);
}
API¶
-
colorTemperatureRange
¶ Get the range of temperatures this color supports.
Returns: Object with min
andmax
in Kelvin.Example:
console.log('Min temperature:', thing.colorTemperatureRange.min); console.log('Max temperature:', thing.colorTemperatureRange.max);
Events¶
-
colorTemperatureRangeChanged
¶ The range of temperature the light supports has changed.
thing.on('colorTemperatureRangeChanged', range => console.log('Range is now', range));
Protected methods¶
-
updateColorTemperatureRange
(min, max)¶ Set the color temperature range the light support.
Arguments: - min (number) – The minimum color temperature in Kelvin.
- max (number) – The maximum color temperature in Kelvin.
Implementing capability¶
Implementors of this capability should call setColorTemperatureRange
either in the constructor or initCallback
.
Example:
const { Light, ColorTemperature } = require('abstract-things/lights'); class Example extends Light.with(ColorTemperature) { constructor() { super(); this.updateColorTemperatureRange(2000, 5000); } }