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