From 0b40123fd9189483d1b9eb8cfbf407d1e8fee5a3 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 27 Apr 2022 16:17:12 +0200 Subject: [PATCH] Migrate qwikswitch light to color_mode (#70805) --- homeassistant/components/qwikswitch/light.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/qwikswitch/light.py b/homeassistant/components/qwikswitch/light.py index 9c31c4660d3..2109b8d2c3b 100644 --- a/homeassistant/components/qwikswitch/light.py +++ b/homeassistant/components/qwikswitch/light.py @@ -1,7 +1,7 @@ """Support for Qwikswitch Relays and Dimmers.""" from __future__ import annotations -from homeassistant.components.light import SUPPORT_BRIGHTNESS, LightEntity +from homeassistant.components.light import ColorMode, LightEntity from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType @@ -33,6 +33,11 @@ class QSLight(QSToggleEntity, LightEntity): return self.device.value if self.device.is_dimmer else None @property - def supported_features(self): - """Flag supported features.""" - return SUPPORT_BRIGHTNESS if self.device.is_dimmer else 0 + def color_mode(self) -> ColorMode: + """Return the color mode of the light.""" + return ColorMode.BRIGHTNESS if self.device.is_dimmer else ColorMode.ONOFF + + @property + def supported_color_modes(self) -> set[ColorMode]: + """Flag supported color modes.""" + return {self.color_mode}