Migrate qwikswitch light to color_mode (#70805)
This commit is contained in:
parent
06c80e454b
commit
0b40123fd9
1 changed files with 9 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
"""Support for Qwikswitch Relays and Dimmers."""
|
"""Support for Qwikswitch Relays and Dimmers."""
|
||||||
from __future__ import annotations
|
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.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
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
|
return self.device.value if self.device.is_dimmer else None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def color_mode(self) -> ColorMode:
|
||||||
"""Flag supported features."""
|
"""Return the color mode of the light."""
|
||||||
return SUPPORT_BRIGHTNESS if self.device.is_dimmer else 0
|
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}
|
||||||
|
|
Loading…
Add table
Reference in a new issue