mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
Add selection between RGB and color temp
This commit is contained in:
parent
d3dce3166e
commit
29a4b8a33c
2 changed files with 18 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
"""Constants for the Adaptive Lighting integration."""
|
||||
|
||||
from homeassistant.components.light import VALID_TRANSITION
|
||||
from homeassistant.helpers import selector
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
|
@ -84,7 +85,19 @@ VALIDATION_TUPLES = [
|
|||
DEFAULT_SLEEP_RGB_COLOR,
|
||||
selector.ColorRGBSelector(selector.ColorRGBSelectorConfig()),
|
||||
),
|
||||
(CONF_SLEEP_RGB_OR_COLOR_TEMP, DEFAULT_SLEEP_RGB_OR_COLOR_TEMP, bool),
|
||||
(
|
||||
CONF_SLEEP_RGB_OR_COLOR_TEMP,
|
||||
DEFAULT_SLEEP_RGB_OR_COLOR_TEMP,
|
||||
selector.SelectSelector(
|
||||
selector.SelectSelectorConfig(
|
||||
options=["color_temp", "rgb"],
|
||||
multiple=False,
|
||||
mode=selector.SelectSelectorMode.DROPDOWN,
|
||||
),
|
||||
)
|
||||
# vol.Any(vol.Literal("color_temp"), vol.Literal("rgb")),
|
||||
# cv.multi_select(["color_temp", "rgb_color"]),
|
||||
),
|
||||
(CONF_SUNRISE_TIME, NONE_STR, str),
|
||||
(CONF_SUNRISE_OFFSET, DEFAULT_SUNRISE_OFFSET, int),
|
||||
(CONF_SUNSET_TIME, NONE_STR, str),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from datetime import timedelta
|
|||
import functools
|
||||
import logging
|
||||
import math
|
||||
from typing import Any
|
||||
from typing import Any, Literal
|
||||
|
||||
import astral
|
||||
from homeassistant.components.light import (
|
||||
|
|
@ -114,6 +114,7 @@ from .const import (
|
|||
CONF_SLEEP_BRIGHTNESS,
|
||||
CONF_SLEEP_COLOR_TEMP,
|
||||
CONF_SLEEP_RGB_COLOR,
|
||||
CONF_SLEEP_RGB_OR_COLOR_TEMP,
|
||||
CONF_SLEEP_TRANSITION,
|
||||
CONF_SUNRISE_OFFSET,
|
||||
CONF_SUNRISE_TIME,
|
||||
|
|
@ -589,6 +590,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
sleep_brightness=data[CONF_SLEEP_BRIGHTNESS],
|
||||
sleep_color_temp=data[CONF_SLEEP_COLOR_TEMP],
|
||||
sleep_rgb_color=data[CONF_SLEEP_RGB_COLOR],
|
||||
sleep_rgb_or_color_temp=data[CONF_SLEEP_RGB_OR_COLOR_TEMP],
|
||||
sunrise_offset=data[CONF_SUNRISE_OFFSET],
|
||||
sunrise_time=data[CONF_SUNRISE_TIME],
|
||||
sunset_offset=data[CONF_SUNSET_OFFSET],
|
||||
|
|
@ -1075,6 +1077,7 @@ class SunLightSettings:
|
|||
min_brightness: int
|
||||
min_color_temp: int
|
||||
sleep_brightness: int
|
||||
sleep_rgb_or_color_temp: Literal["color_temp", "rgb"]
|
||||
sleep_color_temp: int
|
||||
sleep_rgb_color: tuple[int, int, int]
|
||||
sunrise_offset: datetime.timedelta | None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue