mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Migrate decora light to color_mode (#69174)
This commit is contained in:
parent
7e2f024e29
commit
5e44049994
@ -13,8 +13,8 @@ import voluptuous as vol
|
|||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
|
COLOR_MODE_BRIGHTNESS,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_BRIGHTNESS,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_DEVICES, CONF_NAME
|
from homeassistant.const import CONF_API_KEY, CONF_DEVICES, CONF_NAME
|
||||||
@ -25,8 +25,6 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SUPPORT_DECORA_LED = SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
|
|
||||||
def _name_validator(config):
|
def _name_validator(config):
|
||||||
"""Validate the name."""
|
"""Validate the name."""
|
||||||
@ -98,6 +96,9 @@ def setup_platform(
|
|||||||
class DecoraLight(LightEntity):
|
class DecoraLight(LightEntity):
|
||||||
"""Representation of an Decora light."""
|
"""Representation of an Decora light."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
"""Initialize the light."""
|
"""Initialize the light."""
|
||||||
|
|
||||||
@ -128,11 +129,6 @@ class DecoraLight(LightEntity):
|
|||||||
"""Return the brightness of this light between 0..255."""
|
"""Return the brightness of this light between 0..255."""
|
||||||
return self._brightness
|
return self._brightness
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_DECORA_LED
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def assumed_state(self):
|
def assumed_state(self):
|
||||||
"""We can read the actual state."""
|
"""We can read the actual state."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user