mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-12 06:44:04 +02:00
initial implementation of profiles
This commit is contained in:
parent
65b1aa4b84
commit
eb8da2e46b
3 changed files with 8 additions and 2 deletions
|
|
@ -57,7 +57,7 @@ from homeassistant.util.color import (
|
|||
color_xy_to_hs,
|
||||
)
|
||||
|
||||
from .const import _PROFILE_SCHEMA, CONF_PROFILE
|
||||
from .const import _PROFILE_SCHEMA, CONF_PROFILES
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
vol.Optional(
|
||||
ATTR_TRANSITION, default=DEFAULT_TRANSITION
|
||||
): VALID_TRANSITION,
|
||||
vol.Optional(CONF_PROFILE): vol.Schema(
|
||||
vol.Optional(CONF_PROFILES): vol.Schema(
|
||||
{cv.string: vol.Schema(_PROFILE_SCHEMA)}
|
||||
),
|
||||
}
|
||||
|
|
@ -122,6 +122,7 @@ def setup(hass, config):
|
|||
elevation=conf.get(CONF_ELEVATION, hass.config.elevation),
|
||||
interval=conf.get(CONF_INTERVAL),
|
||||
transition=conf.get(ATTR_TRANSITION),
|
||||
profiles=conf.get(CONF_PROFILES, {}),
|
||||
)
|
||||
load_platform(hass, "sensor", DOMAIN, {}, config)
|
||||
|
||||
|
|
@ -145,6 +146,7 @@ class CircadianLighting:
|
|||
elevation,
|
||||
interval,
|
||||
transition,
|
||||
profiles,
|
||||
):
|
||||
self.hass = hass
|
||||
self._min_colortemp = min_colortemp
|
||||
|
|
@ -157,6 +159,8 @@ class CircadianLighting:
|
|||
self._longitude = longitude
|
||||
self._elevation = elevation
|
||||
self._transition = transition
|
||||
self._profiles = profiles
|
||||
_LOGGER.debug("profiles: %s", self._profiles)
|
||||
|
||||
self._percent = self.calc_percent()
|
||||
self._colortemp = self.calc_colortemp()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from homeassistant.components.light import VALID_TRANSITION
|
|||
|
||||
# Switch and profile settings
|
||||
CONF_PROFILE = "profile"
|
||||
CONF_PROFILES = "profiles"
|
||||
CONF_DISABLE_BRIGHTNESS_ADJUST = "disable_brightness_adjust"
|
||||
CONF_MIN_BRIGHT, DEFAULT_MIN_BRIGHT = "min_brightness", 1
|
||||
CONF_MAX_BRIGHT, DEFAULT_MAX_BRIGHT = "max_brightness", 100
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ PLATFORM_SCHEMA = vol.Schema(
|
|||
vol.Optional(CONF_LIGHTS_RGB): cv.entity_ids,
|
||||
vol.Optional(CONF_LIGHTS_XY): cv.entity_ids,
|
||||
vol.Optional(CONF_LIGHTS_BRIGHT): cv.entity_ids,
|
||||
vol.Optional(CONF_PROFILE): cv.string,
|
||||
**_PROFILE_SCHEMA,
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue