From 485a78e0cfece8bb489bbc2c0a37a5b94c613a90 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 21 Mar 2023 11:40:33 +0100 Subject: [PATCH] Improve light type hints in integrations (#90035) * Improve light type hints in integrations * Improve --- homeassistant/components/homematic/light.py | 4 ++-- homeassistant/components/iaqualink/light.py | 2 +- homeassistant/components/knx/light.py | 4 ++-- homeassistant/components/tplink/light.py | 4 ++-- homeassistant/components/velbus/light.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/homematic/light.py b/homeassistant/components/homematic/light.py index 87f3dfb314a..39e6df9d0ec 100644 --- a/homeassistant/components/homematic/light.py +++ b/homeassistant/components/homematic/light.py @@ -68,9 +68,9 @@ class HMLight(HMDevice, LightEntity): return ColorMode.BRIGHTNESS @property - def supported_color_modes(self) -> set[ColorMode | str]: + def supported_color_modes(self) -> set[ColorMode]: """Flag supported color modes.""" - color_modes: set[ColorMode | str] = set() + color_modes: set[ColorMode] = set() if "COLOR" in self._hmdevice.WRITENODE: color_modes.add(ColorMode.HS) diff --git a/homeassistant/components/iaqualink/light.py b/homeassistant/components/iaqualink/light.py index 00c9445a3b5..8b83f701915 100644 --- a/homeassistant/components/iaqualink/light.py +++ b/homeassistant/components/iaqualink/light.py @@ -83,7 +83,7 @@ class HassAqualinkLight(AqualinkEntity, LightEntity): return self.dev.effect @property - def effect_list(self) -> list: + def effect_list(self) -> list[str]: """Return supported light effects.""" return list(self.dev.supported_effects) diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py index e4260f5e868..f5ef8f61b84 100644 --- a/homeassistant/components/knx/light.py +++ b/homeassistant/components/knx/light.py @@ -256,7 +256,7 @@ class KNXLight(KnxEntity, LightEntity): return None @property - def color_mode(self) -> ColorMode | None: + def color_mode(self) -> ColorMode: """Return the color mode of the light.""" if self._device.supports_xyy_color: return ColorMode.XY @@ -276,7 +276,7 @@ class KNXLight(KnxEntity, LightEntity): return ColorMode.ONOFF @property - def supported_color_modes(self) -> set | None: + def supported_color_modes(self) -> set[ColorMode]: """Flag supported color modes.""" return {self.color_mode} diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index 7bbde327e18..e4f91f282f6 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -267,9 +267,9 @@ class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity): return hue, saturation @property - def supported_color_modes(self) -> set[ColorMode | str] | None: + def supported_color_modes(self) -> set[ColorMode]: """Return list of available color modes.""" - modes: set[ColorMode | str] = set() + modes: set[ColorMode] = set() if self.device.is_variable_color_temp: modes.add(ColorMode.COLOR_TEMP) if self.device.is_color: diff --git a/homeassistant/components/velbus/light.py b/homeassistant/components/velbus/light.py index e89c81bc110..ca00a3134ce 100644 --- a/homeassistant/components/velbus/light.py +++ b/homeassistant/components/velbus/light.py @@ -109,7 +109,7 @@ class VelbusButtonLight(VelbusEntity, LightEntity): self._attr_name = f"LED {self._channel.get_name()}" @property - def is_on(self) -> Any: + def is_on(self) -> bool: """Return true if the light is on.""" return self._channel.is_on()