diff --git a/custom_components/adaptive_lighting/const.py b/custom_components/adaptive_lighting/const.py index 5f670b58..15714e6f 100644 --- a/custom_components/adaptive_lighting/const.py +++ b/custom_components/adaptive_lighting/const.py @@ -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), diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 0fc5b983..1e328053 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -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