mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Migrate isy994 light to color_mode (#69282)
This commit is contained in:
parent
dffb3cc196
commit
e9a60418c2
@ -8,8 +8,8 @@ from pyisy.helpers import NodeProperty
|
|||||||
from pyisy.nodes import Node
|
from pyisy.nodes import Node
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
|
COLOR_MODE_BRIGHTNESS,
|
||||||
DOMAIN as LIGHT,
|
DOMAIN as LIGHT,
|
||||||
SUPPORT_BRIGHTNESS,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -51,6 +51,9 @@ async def async_setup_entry(
|
|||||||
class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
|
class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
|
||||||
"""Representation of an ISY994 light device."""
|
"""Representation of an ISY994 light device."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
|
|
||||||
def __init__(self, node: Node, restore_light_state: bool) -> None:
|
def __init__(self, node: Node, restore_light_state: bool) -> None:
|
||||||
"""Initialize the ISY994 light device."""
|
"""Initialize the ISY994 light device."""
|
||||||
super().__init__(node)
|
super().__init__(node)
|
||||||
@ -108,11 +111,6 @@ class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
|
|||||||
attribs[ATTR_LAST_BRIGHTNESS] = self._last_brightness
|
attribs[ATTR_LAST_BRIGHTNESS] = self._last_brightness
|
||||||
return attribs
|
return attribs
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self) -> int:
|
|
||||||
"""Flag supported features."""
|
|
||||||
return SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
async def async_added_to_hass(self) -> None:
|
async def async_added_to_hass(self) -> None:
|
||||||
"""Restore last_brightness on restart."""
|
"""Restore last_brightness on restart."""
|
||||||
await super().async_added_to_hass()
|
await super().async_added_to_hass()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user