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
22 changes: 12 additions & 10 deletions homeassistant/components/plum_lightpad/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
ColorMode,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -115,11 +114,16 @@ def is_on(self) -> bool:
return self._brightness > 0

@property
def supported_features(self):
def color_mode(self) -> ColorMode:
"""Flag supported features."""
if self._load.dimmable:
return SUPPORT_BRIGHTNESS
return 0
return ColorMode.BRIGHTNESS
return ColorMode.ONOFF

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

async def async_turn_on(self, **kwargs):
"""Turn the light on."""
Expand All @@ -136,6 +140,9 @@ async def async_turn_off(self, **kwargs):
class GlowRing(LightEntity):
"""Representation of a Plum Lightpad dimmer glow ring."""

_attr_color_mode = ColorMode.HS
_attr_supported_color_modes = {ColorMode.HS}

def __init__(self, lightpad):
"""Initialize the light."""
self._lightpad = lightpad
Expand Down Expand Up @@ -215,11 +222,6 @@ def icon(self):
"""Return the crop-portrait icon representing the glow ring."""
return "mdi:crop-portrait"

@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR

async def async_turn_on(self, **kwargs):
"""Turn the light on."""
if ATTR_BRIGHTNESS in kwargs:
Expand Down