Migrate tellstick light to color_mode (#69528)

This commit is contained in:
epenet 2022-04-07 09:11:43 +02:00 committed by GitHub
parent 3828c36202
commit e66c4e11c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@ from __future__ import annotations
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
LightEntity,
)
from homeassistant.core import HomeAssistant
@ -18,8 +18,6 @@ from . import (
TellstickDevice,
)
SUPPORT_TELLSTICK = SUPPORT_BRIGHTNESS
def setup_platform(
hass: HomeAssistant,
@ -47,6 +45,9 @@ def setup_platform(
class TellstickLight(TellstickDevice, LightEntity):
"""Representation of a Tellstick light."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
def __init__(self, tellcore_device, signal_repetitions):
"""Initialize the Tellstick light."""
super().__init__(tellcore_device, signal_repetitions)
@ -58,11 +59,6 @@ class TellstickLight(TellstickDevice, LightEntity):
"""Return the brightness of this light between 0..255."""
return self._brightness
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_TELLSTICK
def _parse_ha_data(self, kwargs):
"""Turn the value from HA into something useful."""
return kwargs.get(ATTR_BRIGHTNESS)