mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Migrate tellstick light to color_mode (#69528)
This commit is contained in:
parent
3828c36202
commit
e66c4e11c9
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -18,8 +18,6 @@ from . import (
|
|||||||
TellstickDevice,
|
TellstickDevice,
|
||||||
)
|
)
|
||||||
|
|
||||||
SUPPORT_TELLSTICK = SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(
|
def setup_platform(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
@ -47,6 +45,9 @@ def setup_platform(
|
|||||||
class TellstickLight(TellstickDevice, LightEntity):
|
class TellstickLight(TellstickDevice, LightEntity):
|
||||||
"""Representation of a Tellstick light."""
|
"""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):
|
def __init__(self, tellcore_device, signal_repetitions):
|
||||||
"""Initialize the Tellstick light."""
|
"""Initialize the Tellstick light."""
|
||||||
super().__init__(tellcore_device, signal_repetitions)
|
super().__init__(tellcore_device, signal_repetitions)
|
||||||
@ -58,11 +59,6 @@ class TellstickLight(TellstickDevice, 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_TELLSTICK
|
|
||||||
|
|
||||||
def _parse_ha_data(self, kwargs):
|
def _parse_ha_data(self, kwargs):
|
||||||
"""Turn the value from HA into something useful."""
|
"""Turn the value from HA into something useful."""
|
||||||
return kwargs.get(ATTR_BRIGHTNESS)
|
return kwargs.get(ATTR_BRIGHTNESS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user