kpsuperplane / homebridge-wiz-lan

Control Wiz lights over LAN
Apache License 2.0
116 stars 37 forks source link

NaN error from brightness #96

Open bierlos opened 2 years ago

bierlos commented 2 years ago

This plugin generated a warning from the characteristic 'Brightness': characteristic value expected valid finite number and received "NaN" (number).

MoTechnicalities commented 2 years ago

This is related to #84. I documented the issue. But it is not clear if he will or can fix it.

MoTechnicalities commented 2 years ago

@kpsuperplane The NaN error is generated when a bulb does not send the Brightness characteristic. And this only seems to happens occasionally while a bulb is off ("state":false), as follows:

[24/01/2022, 13:42:22] [Wiz] [Socket] [192.168.1.109:38899] Received message: {"method":"getPilot","env":"pro","result":{"mac":"a8bb50ac67fb","rssi":-63,"src":"","state":false,"sceneId":14}}

Note that after "sceneId":14, there is no dimming level provided, while the bulb happens to be: "state":false. If you redesign the plugin so that no dimming information is mandatory to be collected while the bulb's state is false then the error should no longer be generated.

While preserving a bulbs last brightness level is important information for when a bulb is to be turned back on after having been turned off, officially when a bulb's state is off or false the current Brightness is 0 or Null.