From ca9695f21c753420f4dda0fb2a305d34bf7be2ef Mon Sep 17 00:00:00 2001 From: Niklas Date: Sun, 16 Sep 2018 14:44:14 +0200 Subject: [PATCH] Allow color temperature as low as 1500 --- README.md | 12 ++++++------ lib/lifx-lan-composer.js | 10 +++++----- lib/lifx-lan-device.js | 22 +++++++++++----------- lib/lifx-lan.js | 24 ++++++++++++------------ 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 1e61b58..02fc65f 100644 --- a/README.md +++ b/README.md @@ -479,7 +479,7 @@ Property | Type | Required | Description `hue` | Float | Conditional | Hue in the range of 0.0 to 1.0. `saturation` | Float | Conditional | Saturation in the range of 0.0 to 1.0. `brightness` | Float | Conditional | Brightness in the range of 0.0 to 1.0. -`kelvin` | Integer | Optional | Color temperature (°) in the range of 2500 to 9000. +`kelvin` | Integer | Optional | Color temperature (°) in the range of 1500 to 9000. When the `LifxLanColorHSB` object is used for the [`LifxLan.turnOnBroadcast()`](#LifxLan-turnOnBroadcast-method), [`LifxLan.turnOffBroadcast()`](#LifxLan-turnOffBroadcast-method), and [`LifxLan.setColorBroadcast()`](#LifxLan-setColorBroadcast-method), the `hue`, `saturation`, and `brightness` properties are required. If the `kelvin` property is not specified, it is set to `3500`. @@ -495,7 +495,7 @@ Property | Type | Required | Description `green` | Float | Conditional | Green component in the range of 0.0 to 1.0. `blue` | Float | Conditional | Blue component in the range of 0.0 to 1.0. `brightness` | Float | Optional | Brightness in the range of 0.0 to 1.0. -`kelvin` | Integer | Optional | Color temperature (°) in the range of 2500 to 9000. +`kelvin` | Integer | Optional | Color temperature (°) in the range of 1500 to 9000. When the `LifxLanColorRGB` object is used for the [`LifxLan.turnOnBroadcast()`](#LifxLan-turnOnBroadcast-method), [`LifxLan.setColorBroadcast()`](#LifxLan-setColorBroadcast-method), [`LifxLanDevice.turnOn()`](#LifxLanDevice-turnOn-method), and [`LifxLanDevice.setColor()`](#LifxLanDevice-setColor-method), the `red`, `green`, and `blue` properties are required. If the `kelvin` property is not specified, it is set to `3500`. @@ -510,7 +510,7 @@ Property | Type | Required | Description `x` | Float | Conditional | X value in the range of 0.0 to 1.0. `y` | Float | Conditional | Y value in the range of 0.0 to 1.0. `brightness` | Float | Conditional | Brightness in the range of 0.0 to 1.0. -`kelvin` | Integer | Optional | Color temperature (°) in the range of 2500 to 9000. +`kelvin` | Integer | Optional | Color temperature (°) in the range of 1500 to 9000. When the `LifxLanColorXyb` object is used for the [`LifxLan.turnOnBroadcast()`](#LifxLan-turnOnBroadcast-method), [`LifxLan.turnOffBroadcast()`](#LifxLan-turnOffBroadcast-method), and [`LifxLan.setColorBroadcast()`](#LifxLan-setColorBroadcast-method), the `x`, `y`, and `brightness` properties are required. If the `kelvin` property is not specified, it is set to `3500`. @@ -522,7 +522,7 @@ Property | Type | Required | Description :------------|:--------|:------------|:----------- `css` | String | Conditional | CSS color (`"red"`, `"#ff0000"`, or `"rgb(255, 0, 0)"`) `brightness` | Float | Optional | Brightness in the range of 0.0 to 1.0. -`kelvin` | Integer | Optional | Color temperature (°) in the range of 2500 to 9000. +`kelvin` | Integer | Optional | Color temperature (°) in the range of 1500 to 9000. The `css` property supports all of the named colors specified in the [W3C CSS Color Module Level 4](https://drafts.csswg.org/css-color/#named-colors), such as `"red"`, `"blue"`, `"blueviolet"`, etc. @@ -825,7 +825,7 @@ Property | Type | Description +`hue` | Float | Hue in the range of 0.0 to 1.0. +`saturation` | Float | Saturation in the range of 0.0 to 1.0. +`brightness` | Float | Brightness in the range of 0.0 to 1.0. -+`kelvin` | Integer | Color temperature (°) in the range of 2500 to 9000. ++`kelvin` | Integer | Color temperature (°) in the range of 1500 to 9000. `power` | Integer | If the bulb is turned on, the value is `true`. Otherwise, the value is `false`. `label` | String | The label of the bulb. `infrared` | Object | If the bulb does not have infrared capability, the value is `null`. @@ -836,7 +836,7 @@ Property | Type | Description ++`hue` | Float | Hue in the range of 0.0 to 1.0. ++`saturation`| Float | Saturation in the range of 0.0 to 1.0. ++`brightness`| Float | Brightness in the range of 0.0 to 1.0. -++`kelvin` | Integer | Color temperature (°) in the range of 2500 to 9000. +++`kelvin` | Integer | Color temperature (°) in the range of 1500 to 9000. The code below shows the state of the LIFX bulb: diff --git a/lib/lifx-lan-composer.js b/lib/lifx-lan-composer.js index 262d3ee..ca3f6c8 100644 --- a/lib/lifx-lan-composer.js +++ b/lib/lifx-lan-composer.js @@ -357,7 +357,7 @@ LifxLanComposer.prototype._composePayload58 = function(payload) { * - hue | Float | Required | 0.0 - 1.0 * - saturation | Float | Required | 0.0 - 1.0 * - brightness | Float | Required | 0.0 - 1.0 -* - kelvin | Float | Required | 2500 - 9000 +* - kelvin | Float | Required | 1500 - 9000 * - duration | Integer | Optional | The default value is 0 msec * ---------------------------------------------------------------- */ LifxLanComposer.prototype._composePayload102 = function(payload) { @@ -418,9 +418,9 @@ LifxLanComposer.prototype._checkColorValues = function(data) { let kelvin = 0; if('kelvin' in data) { kelvin = data['kelvin']; - if(typeof(kelvin) !== 'number' || kelvin % 1 !== 0 || kelvin < 2500 || kelvin > 9000) { + if(typeof(kelvin) !== 'number' || kelvin % 1 !== 0 || kelvin < 1500 || kelvin > 9000) { return { - error: new Error('The `color.kelvin` must be an integer between 2500 and 9000.') + error: new Error('The `color.kelvin` must be an integer between 1500 and 9000.') }; } color['kelvin'] = kelvin; @@ -440,7 +440,7 @@ LifxLanComposer.prototype._checkColorValues = function(data) { * - hue | Float | Required | 0.0 - 1.0 * - saturation | Float | Required | 0.0 - 1.0 * - brightness | Float | Required | 0.0 - 1.0 -* - kelvin | Float | Required | 2500 - 9000 +* - kelvin | Float | Required | 1500 - 9000 * - period | Integer | Required | milliseconds * - cycles | Float | Required | Number of cycles * - skew_ratio | Float | Conditional | 0.0 - 1.0. @@ -610,7 +610,7 @@ LifxLanComposer.prototype._composePayload122 = function(payload) { * - hue | Float | Required | 0.0 - 1.0 * - saturation | Float | Required | 0.0 - 1.0 * - brightness | Float | Required | 0.0 - 1.0 -* - kelvin | Float | Required | 2500 - 9000 +* - kelvin | Float | Required | 1500 - 9000 * - duration | Integer | Optional | The default value is 0 msec * - apply | Integer | Optional | The default value is 1. * 0: NO_APPLY, 1: APPLY, 2: APPLY_ONLY diff --git a/lib/lifx-lan-device.js b/lib/lifx-lan-device.js index 7a95962..e64d3e5 100644 --- a/lib/lifx-lan-device.js +++ b/lib/lifx-lan-device.js @@ -104,19 +104,19 @@ LifxLanDevice.prototype._wait = function (msec) { * - hue | Float | Optional | 0.0 - 1.0 * - saturation | Float | Optional | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * * or * * - red | Float | Optional | 0.0 - 1.0 * - green | Float | Optional | 0.0 - 1.0 * - blue | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * * or * * - css | String | Optional | "#ff0000" or "rgb(255, 0, 0)" or "red" format -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * ---------------------------------------------------------------- */ LifxLanDevice.prototype.turnOn = function (params) { if (!params) { @@ -166,7 +166,7 @@ LifxLanDevice.prototype._turnOnSetColor = function (params) { * - hue | Float | Optional | 0.0 - 1.0 * - saturation | Float | Optional | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * * or * @@ -174,13 +174,13 @@ LifxLanDevice.prototype._turnOnSetColor = function (params) { * - green | Float | Optional | 0.0 - 1.0 * - blue | Float | Optional | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * * or * * - css | String | Optional | "#ff0000" or "rgb(255, 0, 0)" or "red" format * - brightness | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * ---------------------------------------------------------------- */ LifxLanDevice.prototype.setColor = function (params) { let promise = new Promise((resolve, reject) => { @@ -633,7 +633,7 @@ LifxLanDevice.prototype.lightGet = function () { * - hue | Float | Required | 0.0 - 1.0 * - saturation | Float | Required | 0.0 - 1.0 * - brightness | Float | Required | 0.0 - 1.0 -* - kelvin | Integer | Required | 2500 - 9000 +* - kelvin | Integer | Required | 1500 - 9000 * - duration | Integer | Optional | The default value is 0 msec * ---------------------------------------------------------------- */ LifxLanDevice.prototype.lightSetColor = function (params) { @@ -648,7 +648,7 @@ LifxLanDevice.prototype.lightSetColor = function (params) { * - hue | Float | Required | 0.0 - 1.0 * - saturation | Float | Required | 0.0 - 1.0 * - brightness | Float | Required | 0.0 - 1.0 -* - kelvin | Integer | Required | 2500 - 9000 +* - kelvin | Integer | Required | 1500 - 9000 * - period | Integer | Required | milliseconds * - cycles | Float | Required | Number of cycles * - skew_ratio | Float | Conditional | 0.0 - 1.0. @@ -711,7 +711,7 @@ LifxLanDevice.prototype.lightSetInfrared = function (params) { * - hue | Float | Optional | 0.0 - 1.0 * - saturation | Float | Optional | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * * or * @@ -719,13 +719,13 @@ LifxLanDevice.prototype.lightSetInfrared = function (params) { * - green | Float | Optional | 0.0 - 1.0 * - blue | Float | Optional | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * * or * * - css | String | Optional | "#ff0000" or "rgb(255, 0, 0)" or "red" format * - brightness | Float | Optional | 0.0 - 1.0 -* - kelvin | Integer | Optional | 2500 - 9000 +* - kelvin | Integer | Optional | 1500 - 9000 * ---------------------------------------------------------------- */ LifxLanDevice.prototype.multiZoneSetColorZones = function (params) { let promise = new Promise((resolve, reject) => { diff --git a/lib/lifx-lan.js b/lib/lifx-lan.js index 7f564d1..fe58a0a 100644 --- a/lib/lifx-lan.js +++ b/lib/lifx-lan.js @@ -178,7 +178,7 @@ LifxLan.prototype.createDevice = function (params) { * - hue | Float | Required | 0.0 - 1.0 * - saturation | Float | Required | 0.0 - 1.0 * - brightness | Float | Required | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000. The default is 3500. + * - kelvin | Integer | Optional | 1500 - 9000. The default is 3500. * * or * @@ -186,13 +186,13 @@ LifxLan.prototype.createDevice = function (params) { * - green | Float | Required | 0.0 - 1.0 * - blue | Float | Required | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000. The default is 3500. + * - kelvin | Integer | Optional | 1500 - 9000. The default is 3500. * * or * * - css | String | Required | "#ff0000" or "rgb(255, 0, 0)" or "red" format * - brightness | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000. The default is 3500. + * - kelvin | Integer | Optional | 1500 - 9000. The default is 3500. * ---------------------------------------------------------------- */ LifxLan.prototype.turnOnBroadcast = function (params) { if (!params) { @@ -244,7 +244,7 @@ LifxLan.prototype._turnOnBroadcastSetColor = function (params) { * - hue | Float | Required | 0.0 - 1.0 * - saturation | Float | Required | 0.0 - 1.0 * - brightness | Float | Required | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000. The default is 3500. + * - kelvin | Integer | Optional | 1500 - 9000. The default is 3500. * * or * @@ -252,13 +252,13 @@ LifxLan.prototype._turnOnBroadcastSetColor = function (params) { * - green | Float | Required | 0.0 - 1.0 * - blue | Float | Required | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000. The default is 3500. + * - kelvin | Integer | Optional | 1500 - 9000. The default is 3500. * * or * * - css | String | Required | "#ff0000" or "rgb(255, 0, 0)" or "red" format * - brightness | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000. The default is 3500. + * - kelvin | Integer | Optional | 1500 - 9000. The default is 3500. * ---------------------------------------------------------------- */ LifxLan.prototype.setColorBroadcast = function (params) { let promise = new Promise((resolve, reject) => { @@ -405,19 +405,19 @@ LifxLan.prototype.turnOffBroadcast = function (params) { * - hue | Float | Optional | 0.0 - 1.0 * - saturation | Float | Optional | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000 + * - kelvin | Integer | Optional | 1500 - 9000 * * or * * - red | Float | Optional | 0.0 - 1.0 * - green | Float | Optional | 0.0 - 1.0 * - blue | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000 + * - kelvin | Integer | Optional | 1500 - 9000 * * or * * - css | String | Optional | "#ff0000" or "rgb(255, 0, 0)" or "red" format - * - kelvin | Integer | Optional | 2500 - 9000 + * - kelvin | Integer | Optional | 1500 - 9000 * ---------------------------------------------------------------- */ LifxLan.prototype.turnOnFilter = function (params) { let promise = new Promise((resolve, reject) => { @@ -486,19 +486,19 @@ LifxLan.prototype.turnOnFilter = function (params) { * - hue | Float | Optional | 0.0 - 1.0 * - saturation | Float | Optional | 0.0 - 1.0 * - brightness | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000 + * - kelvin | Integer | Optional | 1500 - 9000 * * or * * - red | Float | Optional | 0.0 - 1.0 * - green | Float | Optional | 0.0 - 1.0 * - blue | Float | Optional | 0.0 - 1.0 - * - kelvin | Integer | Optional | 2500 - 9000 + * - kelvin | Integer | Optional | 1500 - 9000 * * or * * - css | String | Optional | "#ff0000" or "rgb(255, 0, 0)" or "red" format - * - kelvin | Integer | Optional | 2500 - 9000 + * - kelvin | Integer | Optional | 1500 - 9000 * ---------------------------------------------------------------- */ LifxLan.prototype.setColorFilter = function (params) { let promise = new Promise((resolve, reject) => {