Migrate rfxtrx light to color_mode (#69530)

This commit is contained in:
epenet 2022-04-07 09:09:47 +02:00 committed by GitHub
parent 71b298f3ed
commit 766e6f2e9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,7 +7,7 @@ import RFXtrx as rfxtrxmod
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
COLOR_MODE_BRIGHTNESS,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -20,8 +20,6 @@ from .const import COMMAND_OFF_LIST, COMMAND_ON_LIST
_LOGGER = logging.getLogger(__name__)
SUPPORT_RFXTRX = SUPPORT_BRIGHTNESS
def supported(event: rfxtrxmod.RFXtrxEvent):
"""Return whether an event supports light."""
@ -60,6 +58,8 @@ async def async_setup_entry(
class RfxtrxLight(RfxtrxCommandEntity, LightEntity):
"""Representation of a RFXtrx light."""
_attr_color_mode = COLOR_MODE_BRIGHTNESS
_attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
_brightness = 0
_device: rfxtrxmod.LightingDevice
@ -78,11 +78,6 @@ class RfxtrxLight(RfxtrxCommandEntity, LightEntity):
"""Return the brightness of this light between 0..255."""
return self._brightness
@property
def supported_features(self):
"""Flag supported features."""
return SUPPORT_RFXTRX
@property
def is_on(self):
"""Return true if device is on."""