Migrate tikteck light to ColorMode (#70853)
This commit is contained in:
parent
66551e6fcb
commit
ea4979c511
1 changed files with 4 additions and 9 deletions
|
@ -10,8 +10,7 @@ from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_BRIGHTNESS,
|
ColorMode,
|
||||||
SUPPORT_COLOR,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PASSWORD
|
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_PASSWORD
|
||||||
|
@ -23,8 +22,6 @@ import homeassistant.util.color as color_util
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SUPPORT_TIKTECK_LED = SUPPORT_BRIGHTNESS | SUPPORT_COLOR
|
|
||||||
|
|
||||||
DEVICE_SCHEMA = vol.Schema(
|
DEVICE_SCHEMA = vol.Schema(
|
||||||
{vol.Optional(CONF_NAME): cv.string, vol.Required(CONF_PASSWORD): cv.string}
|
{vol.Optional(CONF_NAME): cv.string, vol.Required(CONF_PASSWORD): cv.string}
|
||||||
)
|
)
|
||||||
|
@ -57,6 +54,9 @@ def setup_platform(
|
||||||
class TikteckLight(LightEntity):
|
class TikteckLight(LightEntity):
|
||||||
"""Representation of a Tikteck light."""
|
"""Representation of a Tikteck light."""
|
||||||
|
|
||||||
|
_attr_color_mode = ColorMode.HS
|
||||||
|
_attr_supported_color_modes = {ColorMode.HS}
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
|
|
||||||
|
@ -97,11 +97,6 @@ class TikteckLight(LightEntity):
|
||||||
"""Return the color property."""
|
"""Return the color property."""
|
||||||
return self._hs
|
return self._hs
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_TIKTECK_LED
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""Return the polling state."""
|
"""Return the polling state."""
|
||||||
|
|
Loading…
Add table
Reference in a new issue