diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index ecbcb84d772..e02d7cdeca0 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -14,12 +14,9 @@ from homeassistant.components.light import ( ATTR_EFFECT, ATTR_HS_COLOR, ATTR_TRANSITION, - COLOR_MODE_BRIGHTNESS, - COLOR_MODE_COLOR_TEMP, - COLOR_MODE_HS, - COLOR_MODE_ONOFF, SUPPORT_EFFECT, SUPPORT_TRANSITION, + ColorMode, LightEntity, ) from homeassistant.config_entries import ConfigEntry @@ -285,32 +282,32 @@ class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity): return SUPPORT_TRANSITION @property - def supported_color_modes(self) -> set[str] | None: + def supported_color_modes(self) -> set[ColorMode | str] | None: """Return list of available color modes.""" - modes = set() + modes: set[ColorMode | str] = set() if self.device.is_variable_color_temp: - modes.add(COLOR_MODE_COLOR_TEMP) + modes.add(ColorMode.COLOR_TEMP) if self.device.is_color: - modes.add(COLOR_MODE_HS) + modes.add(ColorMode.HS) if self.device.is_dimmable: - modes.add(COLOR_MODE_BRIGHTNESS) + modes.add(ColorMode.BRIGHTNESS) if not modes: - modes.add(COLOR_MODE_ONOFF) + modes.add(ColorMode.ONOFF) return modes @property - def color_mode(self) -> str | None: + def color_mode(self) -> ColorMode: """Return the active color mode.""" if self.device.is_color: if self.device.is_variable_color_temp and self.device.color_temp: - return COLOR_MODE_COLOR_TEMP - return COLOR_MODE_HS + return ColorMode.COLOR_TEMP + return ColorMode.HS if self.device.is_variable_color_temp: - return COLOR_MODE_COLOR_TEMP + return ColorMode.COLOR_TEMP - return COLOR_MODE_BRIGHTNESS + return ColorMode.BRIGHTNESS class TPLinkSmartLightStrip(TPLinkSmartBulb):