sammy1881 / homebridge-sengled-bulbs

Homebridge plug-in for Sengled zigged bulbs
2 stars 4 forks source link

Add Adaptive Lighting Support. #14

Open RandyTidd opened 2 years ago

RandyTidd commented 2 years ago

Issue #13

Adds adaptive light support via the AdaptiveLightingController in automatic mode. This sets color temperature every 60 seconds, but since there are only 100 unique levels, it often repeats values. To avoid unnecessary traffic to Sengled servers, added support to skip setting color temperature if it is already at that value. This support also updates color temperature even when the lights are off, so added support to cache the color temperature value and set it when the light is turned on.

The config schema is updated to expose the adaptive lighting support in an experimental features category. The timeout and alternate login options were moved to an advanced section. Both are collapsed by default. Updated readme to reflect these changes.

Noticed that the "Cookie found, skipping login request." path fulfilled the promise, but didn't return so the login code was till executing. This change fixes that, and adds an axios response interceptor to attempt login again if we get a not authorized response.

Some code formatting changes to convert spaces to tabs for indentations, which seemed to be the preference for most of the code and switched braces to K&R where I hadn't followed convention in the past.

Added some additional error checking for client requests.

smcarlsonpdx commented 2 months ago

Are the latest changes enabling adaptive lighting for HomeKit committed to the packages included with HomeBridge Plugins? I do not see the options in the Plugin Config.

Can this commit be approved soon?