peter-murray / node-hue-api

Node.js Library for interacting with the Philips Hue Bridge and Lights
Apache License 2.0
1.19k stars 145 forks source link

Wrong upper range maxValue for brightness #75

Closed mwittig closed 8 years ago

mwittig commented 8 years ago

node-hue-api defines the range for brightness as 0..255. However, my understanding of the hue Core Concepts is, that the range should be 0..254!

When node-hue-api is used along with the Hue Emulator, a brightness value of 255 causes the emulator ro apparently flips the value to 0 as the virtual bulbs turn black. That is probably a bug in the emulator as the Core Concepts document is suggesting the bridge will turn a value of 255 to 254. Well, I currently have no bridge to test with. May be you can tell me. Anyhow, I think using a value of 255 should be regarded as bug. At least, the internal use of brightness as part of the color functions rgb and hsl, for example, should only use the range of 0..254.

mwittig commented 8 years ago

I have tested my fix with my own test program and it works as expected If .bri(255) is called, the value will be changed internally to 254 as specified in the Core Concepts.

peter-murray commented 8 years ago

A very old version of the API did accept and use 255 as the maximum value. It was an oddity, but what the bridge did at the time.

Thanks for the update in putting this right under the newer versions of the API.