Skip to content

Commit

Permalink
Merge pull request #87 from L-four/master
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarmer08 authored Jul 4, 2023
2 parents ebb747a + 73f2b4b commit 84111f6
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions custom_components/sengledapi/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP,
SUPPORT_COLOR,
LightEntity,
ColorMode,
)
Expand Down Expand Up @@ -155,18 +158,29 @@ def supported_features(self):
"""Flags Supported Features"""
features = 0
if self._support_brightness:
features = ColorMode.BRIGHTNESS
if self._support_color_temp and self._support_brightness:
features = ColorMode.BRIGHTNESS | ColorMode.COLOR_TEMP
if (
self._support_brightness
and self._support_color_temp
and self._support_color
):
features = ColorMode.BRIGHTNESS | ColorMode.COLOR_TEMP | ColorMode.HS
features = SUPPORT_BRIGHTNESS
if self._support_color_temp:
features = features | SUPPORT_COLOR_TEMP
if self._support_color:
features = features | SUPPORT_COLOR
_LOGGER.debug("supported_features: %s", features)
return features

@property
def supported_color_modes(self):
"""Flags Supported Features"""
features = set()
if self._support_brightness:
features.add(ColorMode.BRIGHTNESS)
if self._support_color_temp:
features.add(ColorMode.COLOR_TEMP)
if self._support_color:
features.add(ColorMode.HS)
_LOGGER.debug("supported_color_modes: %s", features)
return features

async def async_turn_on(self, **kwargs):
_LOGGER.debug("turn_on kwargs: %s", kwargs)
"""Turn on or control the light."""
if (
ATTR_BRIGHTNESS not in kwargs
Expand Down

0 comments on commit 84111f6

Please sign in to comment.