Closed twam closed 10 years ago
The Lights API still specifies a range of 0-255 for brightness whereas the API now (in 1.1) complains with an error when setting the brightness to 255:
Error Domain=com.philips.hue.sdk Code=80 \"brightness should be a value between 0 and 254\" UserInfo=0x82a6b40 {NSLocalizedDescription=brightness should be a value between 0 and 254}
Why do the Specfication and API differ? What's wrong with 255? What does 255 stand for if it is now a valid brightness value?
there are 255 possibilities,
counting from zero, your integer will only reach 254
the error is likely new because the APIs are recently created and tending those details takes time is all.
On Aug 12, 2013, at 12:57 PM, Tobias Müller notifications@github.com wrote:
The Lights API still specifies a range of 0-255 for brightness whereas the API now (in 1.1) complains with an error when setting the brightness to 255:
Error Domain=com.philips.hue.sdk Code=80 \"brightness should be a value between 0 and 254\" UserInfo=0x82a6b40 {NSLocalizedDescription=brightness should be a value between 0 and 254}
Why do the Specfication and API differ? What's wrong with 255? What does 255 stand for if it is now a valid brightness value?
— Reply to this email directly or view it on GitHub.
Why 255 possibilities and not 256? Why the discrepancy to the Lights API?
oh, sorry, maybe they got confused like me - it does seem like you should not get an error report in your example and I’d submit that as a possible bug.
On Aug 12, 2013, at 1:43 PM, Tobias Müller notifications@github.com wrote:
Why 255 possibilities and not 256? Why the discrepancy to the Lights API?
— Reply to this email directly or view it on GitHub.
According to the specification a range from 0 - 255 is supported. The bridge doesn't support 255, although it accepts the value, and will scale it back to 254 after some time. This behaviour could be very confusing for other users, so we decided to restrict the user from sending 255 to the bridge.
The Lights API specifies a range of 0-255 for brightness and saturation. The comments in the PHLightState.h header file only allow 254 as a maximum value.