Skip to content

Commit

Permalink
Merge pull request #316 from basnijholt/white_value_remove
Browse files Browse the repository at this point in the history
Remove support for "white_value", closes #313
  • Loading branch information
basnijholt authored Aug 28, 2022
2 parents f7420c4 + 150c7f9 commit 0f5af76
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
27 changes: 0 additions & 27 deletions custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@
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,
Expand Down Expand Up @@ -134,7 +132,6 @@

_SUPPORT_OPTS = {
"brightness": SUPPORT_BRIGHTNESS,
"white_value": SUPPORT_WHITE_VALUE,
"color_temp": SUPPORT_COLOR_TEMP,
"color": SUPPORT_COLOR,
"transition": SUPPORT_TRANSITION,
Expand Down Expand Up @@ -163,7 +160,6 @@

BRIGHTNESS_ATTRS = {
ATTR_BRIGHTNESS,
ATTR_WHITE_VALUE,
ATTR_BRIGHTNESS_PCT,
ATTR_BRIGHTNESS_STEP,
ATTR_BRIGHTNESS_STEP_PCT,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -799,10 +776,6 @@ async def _adapt_light(
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
Expand Down
3 changes: 1 addition & 2 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"name": "Adaptive Lighting",
"render_readme": true,
"domains": ["switch"]
"render_readme": true
}

0 comments on commit 0f5af76

Please sign in to comment.