diff --git a/homeassistant/components/control4/light.py b/homeassistant/components/control4/light.py index 539547a79f1..51da8113710 100644 --- a/homeassistant/components/control4/light.py +++ b/homeassistant/components/control4/light.py @@ -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 diff --git a/homeassistant/components/decora_wifi/light.py b/homeassistant/components/decora_wifi/light.py index 3c43e816097..820b5c8f53a 100644 --- a/homeassistant/components/decora_wifi/light.py +++ b/homeassistant/components/decora_wifi/light.py @@ -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 diff --git a/homeassistant/components/esphome/light.py b/homeassistant/components/esphome/light.py index 624dfc8950f..76de857a863 100644 --- a/homeassistant/components/esphome/light.py +++ b/homeassistant/components/esphome/light.py @@ -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 diff --git a/homeassistant/components/homematic/light.py b/homeassistant/components/homematic/light.py index 38a75266a17..87f3dfb314a 100644 --- a/homeassistant/components/homematic/light.py +++ b/homeassistant/components/homematic/light.py @@ -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 diff --git a/homeassistant/components/iaqualink/light.py b/homeassistant/components/iaqualink/light.py index 91ca64a87e6..15800419ed5 100644 --- a/homeassistant/components/iaqualink/light.py +++ b/homeassistant/components/iaqualink/light.py @@ -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 diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 098b627cf48..80110dbd006 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -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 diff --git a/homeassistant/components/smartthings/light.py b/homeassistant/components/smartthings/light.py index ccf63582e86..514296d156a 100644 --- a/homeassistant/components/smartthings/light.py +++ b/homeassistant/components/smartthings/light.py @@ -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 diff --git a/homeassistant/components/template/light.py b/homeassistant/components/template/light.py index db1c89921d1..8e0027b323f 100644 --- a/homeassistant/components/template/light.py +++ b/homeassistant/components/template/light.py @@ -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: diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index f946629813e..65967eb6bea 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -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 diff --git a/homeassistant/components/upb/light.py b/homeassistant/components/upb/light.py index 85cda1f0061..47680714d19 100644 --- a/homeassistant/components/upb/light.py +++ b/homeassistant/components/upb/light.py @@ -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 diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 3da5a537435..2d29ea2fb1a 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -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",