mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Improve light type hints in integrations (#90035)
* Improve light type hints in integrations * Improve
This commit is contained in:
parent
33e698d67f
commit
485a78e0cf
@ -68,9 +68,9 @@ class HMLight(HMDevice, LightEntity):
|
|||||||
return ColorMode.BRIGHTNESS
|
return ColorMode.BRIGHTNESS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_color_modes(self) -> set[ColorMode | str]:
|
def supported_color_modes(self) -> set[ColorMode]:
|
||||||
"""Flag supported color modes."""
|
"""Flag supported color modes."""
|
||||||
color_modes: set[ColorMode | str] = set()
|
color_modes: set[ColorMode] = set()
|
||||||
|
|
||||||
if "COLOR" in self._hmdevice.WRITENODE:
|
if "COLOR" in self._hmdevice.WRITENODE:
|
||||||
color_modes.add(ColorMode.HS)
|
color_modes.add(ColorMode.HS)
|
||||||
|
@ -83,7 +83,7 @@ class HassAqualinkLight(AqualinkEntity, LightEntity):
|
|||||||
return self.dev.effect
|
return self.dev.effect
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def effect_list(self) -> list:
|
def effect_list(self) -> list[str]:
|
||||||
"""Return supported light effects."""
|
"""Return supported light effects."""
|
||||||
return list(self.dev.supported_effects)
|
return list(self.dev.supported_effects)
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ class KNXLight(KnxEntity, LightEntity):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def color_mode(self) -> ColorMode | None:
|
def color_mode(self) -> ColorMode:
|
||||||
"""Return the color mode of the light."""
|
"""Return the color mode of the light."""
|
||||||
if self._device.supports_xyy_color:
|
if self._device.supports_xyy_color:
|
||||||
return ColorMode.XY
|
return ColorMode.XY
|
||||||
@ -276,7 +276,7 @@ class KNXLight(KnxEntity, LightEntity):
|
|||||||
return ColorMode.ONOFF
|
return ColorMode.ONOFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_color_modes(self) -> set | None:
|
def supported_color_modes(self) -> set[ColorMode]:
|
||||||
"""Flag supported color modes."""
|
"""Flag supported color modes."""
|
||||||
return {self.color_mode}
|
return {self.color_mode}
|
||||||
|
|
||||||
|
@ -267,9 +267,9 @@ class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity):
|
|||||||
return hue, saturation
|
return hue, saturation
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supported_color_modes(self) -> set[ColorMode | str] | None:
|
def supported_color_modes(self) -> set[ColorMode]:
|
||||||
"""Return list of available color modes."""
|
"""Return list of available color modes."""
|
||||||
modes: set[ColorMode | str] = set()
|
modes: set[ColorMode] = set()
|
||||||
if self.device.is_variable_color_temp:
|
if self.device.is_variable_color_temp:
|
||||||
modes.add(ColorMode.COLOR_TEMP)
|
modes.add(ColorMode.COLOR_TEMP)
|
||||||
if self.device.is_color:
|
if self.device.is_color:
|
||||||
|
@ -109,7 +109,7 @@ class VelbusButtonLight(VelbusEntity, LightEntity):
|
|||||||
self._attr_name = f"LED {self._channel.get_name()}"
|
self._attr_name = f"LED {self._channel.get_name()}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> Any:
|
def is_on(self) -> bool:
|
||||||
"""Return true if the light is on."""
|
"""Return true if the light is on."""
|
||||||
return self._channel.is_on()
|
return self._channel.is_on()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user