claytonjn / hass-circadian_lighting

Circadian Lighting custom component for Home Assistant
Apache License 2.0
756 stars 89 forks source link

Lights jitter on and off at 100% brightness when Circadian value is around -100% #226

Open DavidGeorge528 opened 1 year ago

DavidGeorge528 commented 1 year ago

I have several lights configured with this integration and 99% of the time they work perfectly. However, when the Circadian value of the integration approximates -100% (-99.9571318200582% when testing currently), the lights do not perform as expected. Specifically, they are set to 100% brightness and continuously flicker on and off. During this time the lights are also uncontrollable, as toggling them is overridden by the integration and it keeps flickering them on and off at 100% brightness. Even power cycling the lights doesn't fix it, as once they re-pair with HA the integration begins the flickering again. The only way to stop this is to turn off the provided switch within the integration.

I monitored the value, testing each time it updated every 5 minutes, and found the integration performed normally again once the Circadian value hit -99.6926790484641%. I suspect this is some rounding issue when assigning very small values to the lights, causing some form of wrap-around to 100% brightness and the flickering.

I also suspect this is a similar problem to those outlined in the following issues: #225, #216, and possibly more.

I'm not sure of a proper fix, or if this is specific to certain bulbs (All my bulbs are Nenoleaf A60 paired with SkyConnect and the Tread integration), but perhaps a hard cap on how low the Circadian value can go needs to be implemented so it cannot reach -100% or other values which cause the error.