Use ColorMode enum in upb (#70551)

This commit is contained in:
epenet 2022-04-23 22:02:04 +02:00 committed by GitHub
parent 20336ec49c
commit 265bf3e9e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]: