mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
renames
This commit is contained in:
parent
2f9a6d7706
commit
dfa0f8cc60
3 changed files with 7 additions and 11 deletions
|
|
@ -57,9 +57,7 @@ VERSION = "1.0.13"
|
|||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DOMAIN = "circadian_lighting"
|
||||
CIRCADIAN_LIGHTING_PLATFORMS = ["sensor", "switch"]
|
||||
CIRCADIAN_LIGHTING_UPDATE_TOPIC = "{}_update".format(DOMAIN)
|
||||
DATA_CIRCADIAN_LIGHTING = "data_cl"
|
||||
CIRCADIAN_LIGHTING_UPDATE_TOPIC = f"{DOMAIN}_update"
|
||||
|
||||
CONF_MIN_CT = "min_colortemp"
|
||||
DEFAULT_MIN_CT = 2500
|
||||
|
|
@ -106,7 +104,7 @@ def setup(hass, config):
|
|||
conf = config[DOMAIN]
|
||||
load_platform(hass, "sensor", DOMAIN, {}, config)
|
||||
|
||||
hass.data[DATA_CIRCADIAN_LIGHTING] = CircadianLighting(
|
||||
hass.data[DOMAIN] = CircadianLighting(
|
||||
hass,
|
||||
min_colortemp=conf.get(CONF_MIN_CT),
|
||||
max_colortemp=conf.get(CONF_MAX_CT),
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ from homeassistant.helpers.entity import Entity
|
|||
|
||||
from custom_components.circadian_lighting import (
|
||||
CIRCADIAN_LIGHTING_UPDATE_TOPIC,
|
||||
DATA_CIRCADIAN_LIGHTING,
|
||||
DOMAIN,
|
||||
)
|
||||
|
||||
|
|
@ -23,7 +22,7 @@ ICON = "mdi:theme-light-dark"
|
|||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up the Circadian Lighting sensor."""
|
||||
cl = hass.data.get(DATA_CIRCADIAN_LIGHTING)
|
||||
cl = hass.data.get(DOMAIN)
|
||||
if cl:
|
||||
cs = CircadianSensor(hass, cl)
|
||||
add_devices([cs])
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ DEPENDENCIES = ["circadian_lighting", "light"]
|
|||
|
||||
import logging
|
||||
from contextlib import suppress
|
||||
from typing import Optional
|
||||
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import voluptuous as vol
|
||||
|
|
@ -40,7 +39,7 @@ from homeassistant.util.color import (
|
|||
|
||||
from custom_components.circadian_lighting import (
|
||||
CIRCADIAN_LIGHTING_UPDATE_TOPIC,
|
||||
DATA_CIRCADIAN_LIGHTING,
|
||||
DOMAIN,
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
@ -107,9 +106,9 @@ PLATFORM_SCHEMA = vol.Schema(
|
|||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up the Circadian Lighting switches."""
|
||||
cl = hass.data.get(DATA_CIRCADIAN_LIGHTING)
|
||||
cl = hass.data.get(DOMAIN)
|
||||
if cl:
|
||||
cs = CircadianSwitch(
|
||||
switch = CircadianSwitch(
|
||||
hass,
|
||||
cl,
|
||||
name=config.get(CONF_NAME),
|
||||
|
|
@ -129,7 +128,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
|||
initial_transition=config.get(CONF_INITIAL_TRANSITION),
|
||||
once_only=config.get(CONF_ONCE_ONLY),
|
||||
)
|
||||
add_devices([cs])
|
||||
add_devices([switch])
|
||||
|
||||
return True
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue