Migrate isy994 light to color_mode (#69282)

This commit is contained in:
Erik Montnemery 2022-04-04 18:19:32 +02:00 committed by GitHub
parent dffb3cc196
commit e9a60418c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,8 +8,8 @@ from pyisy.helpers import NodeProperty
from pyisy.nodes import Node
from homeassistant.components.light import (
COLOR_MODE_BRIGHTNESS,
DOMAIN as LIGHT,
SUPPORT_BRIGHTNESS,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -51,6 +51,9 @@ async def async_setup_entry(
class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
"""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:
"""Initialize the ISY994 light device."""
super().__init__(node)
@ -108,11 +111,6 @@ class ISYLightEntity(ISYNodeEntity, LightEntity, RestoreEntity):
attribs[ATTR_LAST_BRIGHTNESS] = self._last_brightness
return attribs
@property
def supported_features(self) -> int:
"""Flag supported features."""
return SUPPORT_BRIGHTNESS
async def async_added_to_hass(self) -> None:
"""Restore last_brightness on restart."""
await super().async_added_to_hass()