mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Use ColorMode enum in upb (#70551)
This commit is contained in:
parent
20336ec49c
commit
265bf3e9e0
@ -3,10 +3,9 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_FLASH,
|
ATTR_FLASH,
|
||||||
ATTR_TRANSITION,
|
ATTR_TRANSITION,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
|
||||||
COLOR_MODE_ONOFF,
|
|
||||||
SUPPORT_FLASH,
|
SUPPORT_FLASH,
|
||||||
SUPPORT_TRANSITION,
|
SUPPORT_TRANSITION,
|
||||||
|
ColorMode,
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -57,11 +56,11 @@ class UpbLight(UpbAttachedEntity, LightEntity):
|
|||||||
self._brightness = self._element.status
|
self._brightness = self._element.status
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def color_mode(self) -> str:
|
def color_mode(self) -> ColorMode:
|
||||||
"""Return the color mode of the light."""
|
"""Return the color mode of the light."""
|
||||||
if self._element.dimmable:
|
if self._element.dimmable:
|
||||||
return COLOR_MODE_BRIGHTNESS
|
return ColorMode.BRIGHTNESS
|
||||||
return COLOR_MODE_ONOFF
|
return ColorMode.ONOFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_color_modes(self) -> set[str]:
|
def supported_color_modes(self) -> set[str]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user