From 34a855d75f5d85569fb1a705075e067cd6ae023d Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Sun, 28 Aug 2022 11:19:40 -0700 Subject: [PATCH 1/2] Remove support for "white_value", closes #313 --- custom_components/adaptive_lighting/switch.py | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index 1de61655..cd68e8d0 100755 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -28,14 +28,12 @@ from homeassistant.components.light import ( ATTR_KELVIN, ATTR_RGB_COLOR, ATTR_TRANSITION, - ATTR_WHITE_VALUE, ATTR_XY_COLOR, DOMAIN as LIGHT_DOMAIN, SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_TRANSITION, - SUPPORT_WHITE_VALUE, VALID_TRANSITION, is_on, COLOR_MODE_RGB, @@ -134,7 +132,6 @@ from .const import ( _SUPPORT_OPTS = { "brightness": SUPPORT_BRIGHTNESS, - "white_value": SUPPORT_WHITE_VALUE, "color_temp": SUPPORT_COLOR_TEMP, "color": SUPPORT_COLOR, "transition": SUPPORT_TRANSITION, @@ -163,7 +160,6 @@ COLOR_ATTRS = { # Should ATTR_PROFILE be in here? BRIGHTNESS_ATTRS = { ATTR_BRIGHTNESS, - ATTR_WHITE_VALUE, ATTR_BRIGHTNESS_PCT, ATTR_BRIGHTNESS_STEP, ATTR_BRIGHTNESS_STEP_PCT, @@ -207,7 +203,6 @@ def _split_service_data(service_data, adapt_brightness, adapt_color): service_datas = [] if adapt_color: service_data_color = service_data.copy() - service_data_color.pop(ATTR_WHITE_VALUE, None) service_data_color.pop(ATTR_BRIGHTNESS, None) service_datas.append(service_data_color) if adapt_brightness: @@ -471,24 +466,6 @@ def _attributes_have_changed( ) return True - if ( - adapt_brightness - and ATTR_WHITE_VALUE in old_attributes - and ATTR_WHITE_VALUE in new_attributes - ): - last_white_value = old_attributes[ATTR_WHITE_VALUE] - current_white_value = new_attributes[ATTR_WHITE_VALUE] - if abs(current_white_value - last_white_value) > BRIGHTNESS_CHANGE: - _LOGGER.debug( - "White Value of '%s' significantly changed from %s to %s with" - " context.id='%s'", - light, - last_white_value, - current_white_value, - context.id, - ) - return True - if ( adapt_color and ATTR_COLOR_TEMP in old_attributes @@ -799,10 +776,6 @@ class AdaptiveSwitch(SwitchEntity, RestoreEntity): brightness = round(255 * self._settings["brightness_pct"] / 100) service_data[ATTR_BRIGHTNESS] = brightness - if "white_value" in features and adapt_brightness: - white_value = round(255 * self._settings["brightness_pct"] / 100) - service_data[ATTR_WHITE_VALUE] = white_value - if ( "color_temp" in features and adapt_color From 150c7f9c925df1cb9b8fd5956cc8ecb199beef59 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Sun, 28 Aug 2022 11:22:03 -0700 Subject: [PATCH 2/2] remove domains from hacs.json --- hacs.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hacs.json b/hacs.json index 500d0ebd..1a865d2d 100644 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,4 @@ { "name": "Adaptive Lighting", - "render_readme": true, - "domains": ["switch"] + "render_readme": true }