From 5811e43319f505e6b07ea5921a30f96a6b4e93d1 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sat, 23 Apr 2022 21:16:58 +0200 Subject: [PATCH] Use ColorMode enum in iglo (#70512) --- homeassistant/components/iglo/light.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/iglo/light.py b/homeassistant/components/iglo/light.py index a741627cfa4..39e1a5986ab 100644 --- a/homeassistant/components/iglo/light.py +++ b/homeassistant/components/iglo/light.py @@ -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):