sammy1881 / homebridge-sengled-bulbs

Homebridge plug-in for Sengled zigged bulbs
2 stars 4 forks source link

Bulb brightness percentage is wrong. #16

Closed siddrajput closed 2 years ago

siddrajput commented 2 years ago

Hi,

The bulb brightness percentage shown in Homebridge UI is wrong. It shows as 255%. It should be 100%. See picture below.

image

RandyTidd commented 2 years ago

We set the brightness range from 0-255 for the brightness characteristic:

https://github.com/sammy1881/homebridge-sengled-bulbs/blob/eeb7bd5caa36b591bb03486eeb9b9b850e3fe10e/lib/client.js#L41

The sengled api has a 0-255 representation of brightness, so the thought was to expose all the values that could be set. Homebridge UI and the Eve app both let you set the values 0-255, but the UI doesn't normalize the percentage values so the UI shows 255% for max brightness. I think this is their issue, but perhaps it's not worth fighting this. Maybe we are the only ones using alternate brightness min/max. I also don't know what the standard says.

Home app still shows 0-100%, but I think it just get's mapped to the corresponding 0-255 so some values aren't possible to set through that app.

If we want to change, we need to change the min/max at the link above, but the setbrightness call in index.js also needs to convert from 0-100 to 0-255 again.

siddrajput commented 2 years ago

Thanks for the info.