mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Migrate plum_lightpad light to ColorMode (#70880)
This commit is contained in:
parent
0b40123fd9
commit
25d2c63827
@ -8,8 +8,7 @@ from plumlightpad import Plum
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_HS_COLOR,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -115,11 +114,16 @@ class PlumLight(LightEntity):
|
||||
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."""
|
||||
@ -136,6 +140,9 @@ class PlumLight(LightEntity):
|
||||
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
|
||||
@ -215,11 +222,6 @@ class GlowRing(LightEntity):
|
||||
"""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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user