Migrate wilight light to ColorMode (#70855)

pull/70859/head
epenet 2022-04-27 10:02:54 +02:00 committed by GitHub
parent ad348d3273
commit b9ce236054
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 22 deletions

View File

@ -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):