danTapps / homebridge-hubitat-makerapi

Apache License 2.0
29 stars 15 forks source link

RFC: hue should should not convert between 0-100 and 0-360 #6

Open HelveticaScenario opened 5 years ago

HelveticaScenario commented 5 years ago

Because you are converting and rounding both directions, the hue that homekit sends often won't be what it gets back later.

example:

  1. Homekit sends 1 for hue.
  2. That gets converted to 0 (Math.round(1/3.6) === 0) and saved in hubitat.
  3. Homekit asks for the hue later.
  4. Hubitat gives homebridge the 0 it saved earlier, then converts that to 0 (Math.round(0*3.6) === 0) and sends it to homekit.

This rounding error happens about 72% of the time.

It appears that homebridge RGB and RGBW drivers have a setting to send and receive hue in degrees (0-360), so the user would just need to set that for all of their RGB and RGBW lights.