mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Use ColorMode enum in lcn (#70515)
This commit is contained in:
parent
a9cd5bd9c8
commit
1ba0a58b6d
@ -8,10 +8,9 @@ import pypck
|
|||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
|
||||||
COLOR_MODE_ONOFF,
|
|
||||||
DOMAIN as DOMAIN_LIGHT,
|
DOMAIN as DOMAIN_LIGHT,
|
||||||
SUPPORT_TRANSITION,
|
SUPPORT_TRANSITION,
|
||||||
|
ColorMode,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -85,9 +84,9 @@ class LcnOutputLight(LcnEntity, LightEntity):
|
|||||||
self._is_dimming_to_zero = False
|
self._is_dimming_to_zero = False
|
||||||
|
|
||||||
if self.dimmable:
|
if self.dimmable:
|
||||||
self._attr_color_mode = COLOR_MODE_BRIGHTNESS
|
self._attr_color_mode = ColorMode.BRIGHTNESS
|
||||||
else:
|
else:
|
||||||
self._attr_color_mode = COLOR_MODE_ONOFF
|
self._attr_color_mode = ColorMode.ONOFF
|
||||||
self._attr_supported_color_modes = {self._attr_color_mode}
|
self._attr_supported_color_modes = {self._attr_color_mode}
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
@ -169,8 +168,8 @@ class LcnOutputLight(LcnEntity, LightEntity):
|
|||||||
class LcnRelayLight(LcnEntity, LightEntity):
|
class LcnRelayLight(LcnEntity, LightEntity):
|
||||||
"""Representation of a LCN light for relay ports."""
|
"""Representation of a LCN light for relay ports."""
|
||||||
|
|
||||||
_attr_color_mode = COLOR_MODE_ONOFF
|
_attr_color_mode = ColorMode.ONOFF
|
||||||
_attr_supported_color_modes = {COLOR_MODE_ONOFF}
|
_attr_supported_color_modes = {ColorMode.ONOFF}
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType
|
self, config: ConfigType, entry_id: str, device_connection: DeviceConnectionType
|
||||||
|
Loading…
x
Reference in New Issue
Block a user