michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
411 stars 114 forks source link

Error converting value -1 to type 'System.Byte'. Path 'state.bri', line 4, position 13. #129

Closed niels9001 closed 6 years ago

niels9001 commented 6 years ago

Got some debug information back from on of my users. Apparently, for a few lights there was a Brightness of -1, which is very strange.

This of course causes an error when deserializing the light state. What is the best way to deal with this? Can we check if the Brightness level is less than 0 and make it 0, or if more than 255 make it 255?

I'll check how these values ended up!

michielpost commented 6 years ago

Not sure what to do with this. It's just the default Json.net converter that converts the value to a byte property. The value of -1 should not be possible.