add new config option

This commit is contained in:
Benjamin Auquite 2023-04-10 04:11:48 -05:00
commit b53a5aff68
2 changed files with 9 additions and 1 deletions

View file

@ -155,8 +155,13 @@ CONF_ADAPT_UNTIL_SLEEP, DEFAULT_ADAPT_UNTIL_SLEEP = (
) )
DOCS[CONF_ADAPT_UNTIL_SLEEP] = ( DOCS[CONF_ADAPT_UNTIL_SLEEP] = (
"When enabled, Adaptive Lighting will treat sleep settings as the minimum, " "When enabled, Adaptive Lighting will treat sleep settings as the minimum, "
"transitioning to these values after sunset. 🌙" "transitioning color temperature to these values after sunset. 🌙"
) )
CONF_ADAPT_BRIGHTNESS_UNTIL_SLEEP, DEFAULT_ADAPT_BRIGHTNESS_UNTIL_SLEEP = (
"transition_brightness_until_sleep",
False,
)
DOCS[CONF_ADAPT_BRIGHTNESS_UNTIL_SLEEP] = "See " + CONF_ADAPT_UNTIL_SLEEP + "."
CONF_ADAPT_DELAY, DEFAULT_ADAPT_DELAY = "adapt_delay", 0 CONF_ADAPT_DELAY, DEFAULT_ADAPT_DELAY = "adapt_delay", 0
DOCS[CONF_ADAPT_DELAY] = ( DOCS[CONF_ADAPT_DELAY] = (

View file

@ -97,6 +97,7 @@ from .const import (
ATTR_ADAPT_BRIGHTNESS, ATTR_ADAPT_BRIGHTNESS,
ATTR_ADAPT_COLOR, ATTR_ADAPT_COLOR,
ATTR_TURN_ON_OFF_LISTENER, ATTR_TURN_ON_OFF_LISTENER,
CONF_ADAPT_BRIGHTNESS_UNTIL_SLEEP,
CONF_ADAPT_DELAY, CONF_ADAPT_DELAY,
CONF_ADAPT_UNTIL_SLEEP, CONF_ADAPT_UNTIL_SLEEP,
CONF_AUTORESET_CONTROL, CONF_AUTORESET_CONTROL,
@ -896,6 +897,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
self._sun_light_settings = SunLightSettings( self._sun_light_settings = SunLightSettings(
name=self._name, name=self._name,
astral_location=location, astral_location=location,
adapt_brightness_until_sleep=data[CONF_ADAPT_BRIGHTNESS_UNTIL_SLEEP],
adapt_until_sleep=data[CONF_ADAPT_UNTIL_SLEEP], adapt_until_sleep=data[CONF_ADAPT_UNTIL_SLEEP],
max_brightness=data[CONF_MAX_BRIGHTNESS], max_brightness=data[CONF_MAX_BRIGHTNESS],
max_color_temp=data[CONF_MAX_COLOR_TEMP], max_color_temp=data[CONF_MAX_COLOR_TEMP],
@ -1436,6 +1438,7 @@ class SunLightSettings:
name: str name: str
astral_location: astral.Location astral_location: astral.Location
adapt_brightness_until_sleep: bool
adapt_until_sleep: bool adapt_until_sleep: bool
max_brightness: int max_brightness: int
max_color_temp: int max_color_temp: int