adaptive-lighting
adaptive-lighting copied to clipboard
Avoid flickering on light turn on with a configurable delay
I've found that often, when Adaptive Lights is enabled, my lights will flicker when turning on, rather than the smooth fade in transition they would normally have. This seems to be caused by Adaptive Lights trying to update the light state as soon as possible when it detects the lights coming on, resulting it in adapting the lights before the fade in transition completes, causing it to reset half of the way through, and thus making a visual flicker.
To work around this issue, I've added and option to have Adaptive Lights wait a configurable amount of time between light on and when the lights are actually adapted. This gives the lights time to do their normal fade in transition, and then adaptive lights can apply its changes as needed after the lights are fully turned on.
This of course means that Adaptive Lights will be less responsive to turn on events, so it is set to no delay by default.
Let me know if there is a better way to solve this problem other than what I've done here, and I will update this PR accordingly. This is mostly a quick hack I threw together, so it might not be ideal.
This blended with Issue 255 would reduce this problem, at least for automation that are turning on your lights.
https://github.com/basnijholt/adaptive-lighting/issues/255
@MangoScango, sorry for the delay in reviewing and merging this. Thanks a lot for your contribution!