Migrate x10 light to color_mode (#69526)

This commit is contained in:
epenet 2022-04-07 09:13:19 +02:00 committed by GitHub
parent 34a9a1d152
commit 72429a6c04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,8 +8,8 @@ import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.const import CONF_DEVICES, CONF_ID, CONF_NAME
@ -20,8 +20,6 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
_LOGGER = logging.getLogger(__name__)
SUPPORT_X10 = SUPPORT_BRIGHTNESS
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
{
vol.Required(CONF_DEVICES): vol.All(
@ -63,6 +61,9 @@ def setup_platform(
class X10Light(LightEntity):
"""Representation of an X10 Light."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
def __init__(self, light, is_cm11a):
"""Initialize an X10 Light."""
self._name = light["name"]
@ -86,11 +87,6 @@ class X10Light(LightEntity):
"""Return true if light is on."""
return self._state
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_X10
def turn_on(self, **kwargs):
"""Instruct the light to turn on."""
if self._is_cm11a: