Migrate wilight light to ColorMode (#70855)
parent
ad348d3273
commit
b9ce236054
|
@ -1,17 +1,10 @@
|
|||
"""Support for WiLight lights."""
|
||||
from pywilight.const import (
|
||||
ITEM_LIGHT,
|
||||
LIGHT_COLOR,
|
||||
LIGHT_DIMMER,
|
||||
LIGHT_ON_OFF,
|
||||
SUPPORT_NONE,
|
||||
)
|
||||
from pywilight.const import ITEM_LIGHT, LIGHT_COLOR, LIGHT_DIMMER, LIGHT_ON_OFF
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_HS_COLOR,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -56,11 +49,6 @@ async def async_setup_entry(
|
|||
class WiLightLightOnOff(WiLightDevice, LightEntity):
|
||||
"""Representation of a WiLights light on-off."""
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag supported features."""
|
||||
return SUPPORT_NONE
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
"""Return true if device is on."""
|
||||
|
@ -78,10 +66,8 @@ class WiLightLightOnOff(WiLightDevice, LightEntity):
|
|||
class WiLightLightDimmer(WiLightDevice, LightEntity):
|
||||
"""Representation of a WiLights light dimmer."""
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag supported features."""
|
||||
return SUPPORT_BRIGHTNESS
|
||||
_attr_color_mode = ColorMode.BRIGHTNESS
|
||||
_attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||
|
||||
@property
|
||||
def brightness(self):
|
||||
|
@ -131,10 +117,8 @@ def hass_to_wilight_saturation(value):
|
|||
class WiLightLightColor(WiLightDevice, LightEntity):
|
||||
"""Representation of a WiLights light rgb."""
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag supported features."""
|
||||
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
||||
_attr_color_mode = ColorMode.HS
|
||||
_attr_supported_color_modes = {ColorMode.HS}
|
||||
|
||||
@property
|
||||
def brightness(self):
|
||||
|
|
Loading…
Reference in New Issue