mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Migrate rfxtrx light to color_mode (#69530)
This commit is contained in:
parent
71b298f3ed
commit
766e6f2e9c
@ -7,7 +7,7 @@ import RFXtrx as rfxtrxmod
|
|||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
SUPPORT_BRIGHTNESS,
|
COLOR_MODE_BRIGHTNESS,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -20,8 +20,6 @@ from .const import COMMAND_OFF_LIST, COMMAND_ON_LIST
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
SUPPORT_RFXTRX = SUPPORT_BRIGHTNESS
|
|
||||||
|
|
||||||
|
|
||||||
def supported(event: rfxtrxmod.RFXtrxEvent):
|
def supported(event: rfxtrxmod.RFXtrxEvent):
|
||||||
"""Return whether an event supports light."""
|
"""Return whether an event supports light."""
|
||||||
@ -60,6 +58,8 @@ async def async_setup_entry(
|
|||||||
class RfxtrxLight(RfxtrxCommandEntity, LightEntity):
|
class RfxtrxLight(RfxtrxCommandEntity, LightEntity):
|
||||||
"""Representation of a RFXtrx light."""
|
"""Representation of a RFXtrx light."""
|
||||||
|
|
||||||
|
_attr_color_mode = COLOR_MODE_BRIGHTNESS
|
||||||
|
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
||||||
_brightness = 0
|
_brightness = 0
|
||||||
_device: rfxtrxmod.LightingDevice
|
_device: rfxtrxmod.LightingDevice
|
||||||
|
|
||||||
@ -78,11 +78,6 @@ class RfxtrxLight(RfxtrxCommandEntity, 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_RFXTRX
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
"""Return true if device is on."""
|
"""Return true if device is on."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user