mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-13 15:24:03 +02:00
add disable_color option
This commit is contained in:
parent
5ee3575efd
commit
199d31b891
2 changed files with 5 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ SUN_EVENT_MIDNIGHT = "solar_midnight"
|
|||
|
||||
CONF_NAME, DEFAULT_NAME = "name", "default"
|
||||
CONF_LIGHTS, DEFAULT_LIGHTS = "lights", []
|
||||
CONF_DISABLE_COLOR, DEFAULT_DISABLE_COLOR = "disable_color", False
|
||||
CONF_DISABLE_BRIGHTNESS_ADJUST, DEFAULT_DISABLE_BRIGHTNESS_ADJUST = (
|
||||
"disable_brightness_adjust",
|
||||
False,
|
||||
|
|
@ -52,6 +53,7 @@ def int_between(a, b):
|
|||
|
||||
VALIDATION_TUPLES = [
|
||||
(CONF_LIGHTS, DEFAULT_LIGHTS, cv.entity_ids),
|
||||
(CONF_DISABLE_COLOR, DEFAULT_DISABLE_COLOR, bool),
|
||||
(CONF_DISABLE_BRIGHTNESS_ADJUST, DEFAULT_DISABLE_BRIGHTNESS_ADJUST, bool),
|
||||
(CONF_DISABLE_ENTITY, NONE_STR, cv.entity_id),
|
||||
(CONF_DISABLE_STATE, NONE_STR, str),
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import homeassistant.util.dt as dt_util
|
|||
from .const import (
|
||||
CONF_COLORS_ONLY,
|
||||
CONF_DISABLE_BRIGHTNESS_ADJUST,
|
||||
CONF_DISABLE_COLOR,
|
||||
CONF_DISABLE_ENTITY,
|
||||
CONF_DISABLE_STATE,
|
||||
CONF_INITIAL_TRANSITION,
|
||||
|
|
@ -165,6 +166,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
self._name = data[CONF_NAME]
|
||||
self._lights = data[CONF_LIGHTS]
|
||||
self._disable_brightness_adjust = data[CONF_DISABLE_BRIGHTNESS_ADJUST]
|
||||
self._disable_color = data[CONF_DISABLE_COLOR]
|
||||
self._disable_entity = data[CONF_DISABLE_ENTITY]
|
||||
self._disable_state = data[CONF_DISABLE_STATE]
|
||||
self._initial_transition = data[CONF_INITIAL_TRANSITION]
|
||||
|
|
@ -442,7 +444,7 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity):
|
|||
):
|
||||
service_data[ATTR_BRIGHTNESS_PCT] = self._brightness
|
||||
|
||||
if "color" in features:
|
||||
if "color" in features and not self._disable_color:
|
||||
service_data[ATTR_RGB_COLOR] = self._rgb_color
|
||||
elif "color_temp" in features:
|
||||
service_data[ATTR_COLOR_TEMP] = self._color_temp_mired
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue