mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use ColorMode enum in eufy (#70491)
This commit is contained in:
parent
cc260db496
commit
4904d7b216
@ -7,9 +7,7 @@ from homeassistant.components.light import (
|
|||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
COLOR_MODE_BRIGHTNESS,
|
ColorMode,
|
||||||
COLOR_MODE_COLOR_TEMP,
|
|
||||||
COLOR_MODE_HS,
|
|
||||||
LightEntity,
|
LightEntity,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -54,11 +52,11 @@ class EufyLight(LightEntity):
|
|||||||
self._bulb = lakeside.bulb(self._address, self._code, self._type)
|
self._bulb = lakeside.bulb(self._address, self._code, self._type)
|
||||||
self._colormode = False
|
self._colormode = False
|
||||||
if self._type == "T1011":
|
if self._type == "T1011":
|
||||||
self._attr_supported_color_modes = {COLOR_MODE_BRIGHTNESS}
|
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
|
||||||
elif self._type == "T1012":
|
elif self._type == "T1012":
|
||||||
self._attr_supported_color_modes = {COLOR_MODE_COLOR_TEMP}
|
self._attr_supported_color_modes = {ColorMode.COLOR_TEMP}
|
||||||
else: # T1013
|
else: # T1013
|
||||||
self._attr_supported_color_modes = {COLOR_MODE_COLOR_TEMP, COLOR_MODE_HS}
|
self._attr_supported_color_modes = {ColorMode.COLOR_TEMP, ColorMode.HS}
|
||||||
self._bulb.connect()
|
self._bulb.connect()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
@ -121,13 +119,13 @@ class EufyLight(LightEntity):
|
|||||||
def color_mode(self) -> str | None:
|
def color_mode(self) -> str | None:
|
||||||
"""Return the color mode of the light."""
|
"""Return the color mode of the light."""
|
||||||
if self._type == "T1011":
|
if self._type == "T1011":
|
||||||
return COLOR_MODE_BRIGHTNESS
|
return ColorMode.BRIGHTNESS
|
||||||
if self._type == "T1012":
|
if self._type == "T1012":
|
||||||
return COLOR_MODE_COLOR_TEMP
|
return ColorMode.COLOR_TEMP
|
||||||
# T1013
|
# T1013
|
||||||
if not self._colormode:
|
if not self._colormode:
|
||||||
return COLOR_MODE_COLOR_TEMP
|
return ColorMode.COLOR_TEMP
|
||||||
return COLOR_MODE_HS
|
return ColorMode.HS
|
||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
"""Turn the specified light on."""
|
"""Turn the specified light on."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user