Adjust type hints for LightEntityFeature (#82251)
This commit is contained in:
parent
8a084cf94d
commit
dd7bc7971f
11 changed files with 14 additions and 14 deletions
|
@ -192,7 +192,7 @@ class Control4Light(Control4Entity, LightEntity):
|
|||
return None
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature | int:
|
||||
"""Flag supported features."""
|
||||
if self._is_dimmer:
|
||||
return LightEntityFeature.TRANSITION
|
||||
|
|
|
@ -112,7 +112,7 @@ class DecoraWifiLight(LightEntity):
|
|||
return {self.color_mode}
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature | int:
|
||||
"""Return supported features."""
|
||||
if self._switch.canSetLevel:
|
||||
return LightEntityFeature.TRANSITION
|
||||
|
|
|
@ -347,9 +347,9 @@ class EsphomeLight(EsphomeEntity[LightInfo, LightState], LightEntity):
|
|||
return self._static_info.supported_color_modes_compat(self._api_version)
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature:
|
||||
"""Flag supported features."""
|
||||
flags: int = LightEntityFeature.FLASH
|
||||
flags = LightEntityFeature.FLASH
|
||||
|
||||
# All color modes except UNKNOWN,ON_OFF support transition
|
||||
modes = self._native_supported_color_modes
|
||||
|
|
|
@ -82,9 +82,9 @@ class HMLight(HMDevice, LightEntity):
|
|||
return color_modes
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature:
|
||||
"""Flag supported features."""
|
||||
features: int = LightEntityFeature.TRANSITION
|
||||
features = LightEntityFeature.TRANSITION
|
||||
if "PROGRAM" in self._hmdevice.WRITENODE:
|
||||
features |= LightEntityFeature.EFFECT
|
||||
return features
|
||||
|
|
|
@ -100,7 +100,7 @@ class HassAqualinkLight(AqualinkEntity, LightEntity):
|
|||
return {self.color_mode}
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature | int:
|
||||
"""Return the list of features supported by the light."""
|
||||
if self.dev.supports_effect:
|
||||
return LightEntityFeature.EFFECT
|
||||
|
|
|
@ -793,7 +793,7 @@ class LightEntity(ToggleEntity):
|
|||
_attr_rgbw_color: tuple[int, int, int, int] | None = None
|
||||
_attr_rgbww_color: tuple[int, int, int, int, int] | None = None
|
||||
_attr_supported_color_modes: set[ColorMode] | set[str] | None = None
|
||||
_attr_supported_features: int = 0
|
||||
_attr_supported_features: LightEntityFeature | int = 0
|
||||
_attr_xy_color: tuple[float, float] | None = None
|
||||
|
||||
@property
|
||||
|
@ -1060,6 +1060,6 @@ class LightEntity(ToggleEntity):
|
|||
return self._attr_supported_color_modes
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature | int:
|
||||
"""Flag supported features."""
|
||||
return self._attr_supported_features
|
||||
|
|
|
@ -101,7 +101,7 @@ class SmartThingsLight(SmartThingsEntity, LightEntity):
|
|||
|
||||
return color_modes
|
||||
|
||||
def _determine_features(self):
|
||||
def _determine_features(self) -> LightEntityFeature | int:
|
||||
"""Get features supported by the device."""
|
||||
features = 0
|
||||
# Transition
|
||||
|
|
|
@ -254,7 +254,7 @@ class LightTemplate(TemplateEntity, LightEntity):
|
|||
return self._supported_color_modes
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature | int:
|
||||
"""Flag supported features."""
|
||||
supported_features = 0
|
||||
if self._effect_script is not None:
|
||||
|
|
|
@ -312,7 +312,7 @@ class TPLinkSmartLightStrip(TPLinkSmartBulb):
|
|||
device: SmartLightStrip
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature | int:
|
||||
"""Flag supported features."""
|
||||
return super().supported_features | LightEntityFeature.EFFECT
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class UpbLight(UpbAttachedEntity, LightEntity):
|
|||
return {self.color_mode}
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> LightEntityFeature:
|
||||
"""Flag supported features."""
|
||||
if self._element.dimmable:
|
||||
return LightEntityFeature.TRANSITION | LightEntityFeature.FLASH
|
||||
|
|
|
@ -1520,7 +1520,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||
),
|
||||
TypeHintMatch(
|
||||
function_name="supported_features",
|
||||
return_type="int",
|
||||
return_type=["LightEntityFeature", "int"],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="turn_on",
|
||||
|
|
Loading…
Add table
Reference in a new issue