From ca337b54a3130c5bd26664793436427a17f643a7 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Sat, 23 Apr 2022 23:27:32 +0200 Subject: [PATCH] Use ColorMode enum in philips_js (#70529) --- homeassistant/components/philips_js/light.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/philips_js/light.py b/homeassistant/components/philips_js/light.py index 72bfd71a876..add37eedc16 100644 --- a/homeassistant/components/philips_js/light.py +++ b/homeassistant/components/philips_js/light.py @@ -10,11 +10,10 @@ from homeassistant.components.light import ( ATTR_BRIGHTNESS, ATTR_EFFECT, ATTR_HS_COLOR, - COLOR_MODE_HS, - COLOR_MODE_ONOFF, SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_EFFECT, + ColorMode, LightEntity, ) from homeassistant.config_entries import ConfigEntry @@ -152,7 +151,7 @@ class PhilipsTVLightEntity( self._last_selected_effect: AmbilightEffect = None super().__init__(coordinator) - self._attr_supported_color_modes = [COLOR_MODE_HS, COLOR_MODE_ONOFF] + self._attr_supported_color_modes = {ColorMode.HS, ColorMode.ONOFF} self._attr_supported_features = ( SUPPORT_EFFECT | SUPPORT_COLOR | SUPPORT_BRIGHTNESS ) @@ -217,16 +216,16 @@ class PhilipsTVLightEntity( return AmbilightEffect(EFFECT_MODE, self._tv.ambilight_mode, None) @property - def color_mode(self): + def color_mode(self) -> ColorMode: """Return the current color mode.""" current = self._tv.ambilight_current_configuration if current and current["isExpert"]: - return COLOR_MODE_HS + return ColorMode.HS if self._tv.ambilight_mode in ["manual", "expert"]: - return COLOR_MODE_HS + return ColorMode.HS - return COLOR_MODE_ONOFF + return ColorMode.ONOFF @property def is_on(self):