kpsuperplane / homebridge-wiz-lan

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

Night light setting generates "NaN Brightness" error #120

Closed AndrewSverdrup closed 1 year ago

AndrewSverdrup commented 2 years ago

The following error message is logged in the Homebridge Logs when lights are set to the "Night light" setting in Wiz:

[homebridge-wiz-lan] This plugin generated a warning from the characteristic 'Brightness': characteristic value expected valid finite number and received "NaN" (number). See https://homebridge.io/w/JtMGR for more info.

AndrewSverdrup commented 2 years ago

Possibly related to https://github.com/kpsuperplane/homebridge-wiz-lan/issues/96

MoTechnicalities commented 2 years ago

@AndrewSverdrup TURNING THE BULB OFF (there are 2 ways with the Home App)

1.) When clicking the Home App Room Tile. For this, the plugin already does turn the light ON/OFF (ONLY) and retains its last setting. Because it only adjusts the WiZ Bulb's boolean true/false state.

2.) When using the Home App Settings Slider. For this, the plugin absolutely needs to give the WiZ Bulb a standard boolean false state setting, but more than that... Using the Slider to turn the light off will cause the "dimming" value to drop to the minimum 10 value. So, the problem is that if you do turn it off this way and the lowest value of 10 gets retained prior to the "state":false change, you will have a problem with the lights being super dim when you use the Home App Room Tile click to turn it back on.

I would suggest that if it is possible to track if a bulb has been turned off using the Home App Settings Slider, then the bulb should be provided both a "state":false and standard values to return to upon an ON Tile click.

The standard WiZ values I'd suggest setting after a Home App Slider OFF are: "state":false (sets the bulb to off) "dimming":100 (sets up the bulb for full brightness upon Tile click) "sceneID":0 (no WiZ Bulb scene) "temp":2700 (a comfortable warm white comparable to scene 11 warm white)

AndrewSverdrup commented 1 year ago

Makes sense. I just did a bit more testing and despite seeing the warning in the Homebridge logs, the lights appear to have the correct brightness.