Skip to content

Commit

Permalink
Merge pull request #12 from nikteg/master
Browse files Browse the repository at this point in the history
Allow color temperature as low as 1500
  • Loading branch information
futomi committed Sep 17, 2018
2 parents 4c9f48a + ca9695f commit 8892839
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -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`.

Expand All @@ -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`.

Expand All @@ -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.

Expand Down Expand Up @@ -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`.
Expand All @@ -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:

Expand Down
10 changes: 5 additions & 5 deletions lib/lifx-lan-composer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions lib/lifx-lan-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -166,21 +166,21 @@ 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
*
* - red | Float | Optional | 0.0 - 1.0
* - 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) => {
Expand Down Expand Up @@ -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) {
Expand All @@ -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.
Expand Down Expand Up @@ -711,21 +711,21 @@ 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
*
* - red | Float | Optional | 0.0 - 1.0
* - 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) => {
Expand Down
24 changes: 12 additions & 12 deletions lib/lifx-lan.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,21 @@ 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
*
* - red | Float | Required | 0.0 - 1.0
* - 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) {
Expand Down Expand Up @@ -244,21 +244,21 @@ 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
*
* - red | Float | Required | 0.0 - 1.0
* - 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) => {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 8892839

Please sign in to comment.