mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Use ColorMode enum in iglo (#70512)
This commit is contained in:
parent
2f26407a31
commit
5811e43319
@ -12,9 +12,8 @@ from homeassistant.components.light import (
|
||||
ATTR_COLOR_TEMP,
|
||||
ATTR_EFFECT,
|
||||
ATTR_HS_COLOR,
|
||||
COLOR_MODE_COLOR_TEMP,
|
||||
COLOR_MODE_HS,
|
||||
PLATFORM_SCHEMA,
|
||||
ColorMode,
|
||||
LightEntity,
|
||||
LightEntityFeature,
|
||||
)
|
||||
@ -53,7 +52,7 @@ def setup_platform(
|
||||
class IGloLamp(LightEntity):
|
||||
"""Representation of an iGlo light."""
|
||||
|
||||
_attr_supported_color_modes = {COLOR_MODE_COLOR_TEMP, COLOR_MODE_HS}
|
||||
_attr_supported_color_modes = {ColorMode.COLOR_TEMP, ColorMode.HS}
|
||||
_attr_supported_features = LightEntityFeature.EFFECT
|
||||
|
||||
def __init__(self, name, host, port):
|
||||
@ -73,13 +72,13 @@ class IGloLamp(LightEntity):
|
||||
return int((self._lamp.state()["brightness"] / 200.0) * 255)
|
||||
|
||||
@property
|
||||
def color_mode(self) -> str | None:
|
||||
def color_mode(self) -> ColorMode:
|
||||
"""Return the color mode of the light."""
|
||||
if self._lamp.state()["mode"] == MODE_WHITE:
|
||||
return COLOR_MODE_COLOR_TEMP
|
||||
return ColorMode.COLOR_TEMP
|
||||
# The iglo library reports MODE_WHITE when an effect is active, this is not
|
||||
# supported by Home Assistant, just report COLOR_MODE_HS
|
||||
return COLOR_MODE_HS
|
||||
# supported by Home Assistant, just report ColorMode.HS
|
||||
return ColorMode.HS
|
||||
|
||||
@property
|
||||
def color_temp(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user