Improve light type hints in integrations (#90035)
* Improve light type hints in integrations * Improve
This commit is contained in:
parent
33e698d67f
commit
485a78e0cf
5 changed files with 8 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue