Migrate opple light to ColorMode (#70875)

This commit is contained in:
epenet 2022-04-27 14:16:51 +02:00 committed by GitHub
parent 13cc7583ed
commit f77bcd252e
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_COLOR_TEMP,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP,
ColorMode,
LightEntity,
)
from homeassistant.const import CONF_HOST, CONF_NAME
@ -55,6 +54,9 @@ def setup_platform(
class OppleLight(LightEntity):
"""Opple light device."""
_attr_color_mode = ColorMode.COLOR_TEMP
_attr_supported_color_modes = {ColorMode.COLOR_TEMP}
def __init__(self, name, host):
"""Initialize an Opple light."""
@ -105,11 +107,6 @@ class OppleLight(LightEntity):
"""Return maximum supported color temperature."""
return 333
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_BRIGHTNESS | SUPPORT_COLOR_TEMP
def turn_on(self, **kwargs):
"""Instruct the light to turn on."""
_LOGGER.debug("Turn on light %s %s", self._device.ip, kwargs)