Migrate tikteck light to ColorMode (#70853)

This commit is contained in:
epenet 2022-04-27 09:52:22 +02:00 committed by GitHub
parent 66551e6fcb
commit ea4979c511
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,8 +10,7 @@ from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
ColorMode,
LightEntity,
)
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__)
SUPPORT_TIKTECK_LED = SUPPORT_BRIGHTNESS | SUPPORT_COLOR
DEVICE_SCHEMA = vol.Schema(
{vol.Optional(CONF_NAME): cv.string, vol.Required(CONF_PASSWORD): cv.string}
)
@ -57,6 +54,9 @@ def setup_platform(
class TikteckLight(LightEntity):
"""Representation of a Tikteck light."""
_attr_color_mode = ColorMode.HS
_attr_supported_color_modes = {ColorMode.HS}
def __init__(self, device):
"""Initialize the light."""
@ -97,11 +97,6 @@ class TikteckLight(LightEntity):
"""Return the color property."""
return self._hs
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_TIKTECK_LED
@property
def should_poll(self):
"""Return the polling state."""