From 766e6f2e9cbc69df72caca10987af4c4ccb5d78b Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 7 Apr 2022 09:09:47 +0200 Subject: [PATCH] Migrate rfxtrx light to color_mode (#69530) --- homeassistant/components/rfxtrx/light.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/rfxtrx/light.py b/homeassistant/components/rfxtrx/light.py index 7212b65cd7e..58e7d4673c8 100644 --- a/homeassistant/components/rfxtrx/light.py +++ b/homeassistant/components/rfxtrx/light.py @@ -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."""