Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions homeassistant/components/upb/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
ATTR_BRIGHTNESS,
ATTR_FLASH,
ATTR_TRANSITION,
SUPPORT_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
COLOR_MODE_ONOFF,
SUPPORT_FLASH,
SUPPORT_TRANSITION,
LightEntity,
Expand Down Expand Up @@ -55,11 +56,23 @@ def __init__(self, element, unique_id, upb):
super().__init__(element, unique_id, upb)
self._brightness = self._element.status

@property
def color_mode(self) -> str:
"""Return the color mode of the light."""
if self._element.dimmable:
return COLOR_MODE_BRIGHTNESS
return COLOR_MODE_ONOFF

@property
def supported_color_modes(self) -> set[str]:
"""Flag supported color modes."""
return {self.color_mode}

@property
def supported_features(self):
"""Flag supported features."""
if self._element.dimmable:
return SUPPORT_BRIGHTNESS | SUPPORT_TRANSITION | SUPPORT_FLASH
return SUPPORT_TRANSITION | SUPPORT_FLASH
return SUPPORT_FLASH

@property
Expand Down