diff --git a/homeassistant/components/bond/fan.py b/homeassistant/components/bond/fan.py index 18ce3777b4e..bd4f01bce52 100644 --- a/homeassistant/components/bond/fan.py +++ b/homeassistant/components/bond/fan.py @@ -82,9 +82,9 @@ class BondFan(BondEntity, FanEntity): self._attr_preset_mode = PRESET_MODE_BREEZE if breeze[0] else None @property - def supported_features(self) -> FanEntityFeature | int: + def supported_features(self) -> FanEntityFeature: """Flag supported features.""" - features = 0 + features = FanEntityFeature(0) if self._device.supports_speed(): features |= FanEntityFeature.SET_SPEED if self._device.supports_direction(): diff --git a/homeassistant/components/esphome/fan.py b/homeassistant/components/esphome/fan.py index fc8a3e600f3..27952d36c60 100644 --- a/homeassistant/components/esphome/fan.py +++ b/homeassistant/components/esphome/fan.py @@ -158,9 +158,9 @@ class EsphomeFan(EsphomeEntity[FanInfo, FanState], FanEntity): return _FAN_DIRECTIONS.from_esphome(self._state.direction) @property - def supported_features(self) -> FanEntityFeature | int: + def supported_features(self) -> FanEntityFeature: """Flag supported features.""" - flags = 0 + flags = FanEntityFeature(0) if self._static_info.supports_oscillation: flags |= FanEntityFeature.OSCILLATE if self._static_info.supports_speed: diff --git a/homeassistant/components/fan/__init__.py b/homeassistant/components/fan/__init__.py index b5cd653502f..e143b93258e 100644 --- a/homeassistant/components/fan/__init__.py +++ b/homeassistant/components/fan/__init__.py @@ -190,7 +190,7 @@ class FanEntity(ToggleEntity): _attr_preset_mode: str | None _attr_preset_modes: list[str] | None _attr_speed_count: int - _attr_supported_features: FanEntityFeature | int = 0 + _attr_supported_features: FanEntityFeature = FanEntityFeature(0) def set_percentage(self, percentage: int) -> None: """Set the speed of the fan, as a percentage.""" @@ -363,7 +363,7 @@ class FanEntity(ToggleEntity): return data @property - def supported_features(self) -> FanEntityFeature | int: + def supported_features(self) -> FanEntityFeature: """Flag supported features.""" return self._attr_supported_features diff --git a/homeassistant/components/group/fan.py b/homeassistant/components/group/fan.py index 09b59a2d123..682890dddd6 100644 --- a/homeassistant/components/group/fan.py +++ b/homeassistant/components/group/fan.py @@ -313,8 +313,10 @@ class FanGroup(GroupEntity, FanEntity): "_direction", FanEntityFeature.DIRECTION, ATTR_DIRECTION ) - self._attr_supported_features = reduce( - ior, [feature for feature in SUPPORTED_FLAGS if self._fans[feature]], 0 + self._attr_supported_features = FanEntityFeature( + reduce( + ior, [feature for feature in SUPPORTED_FLAGS if self._fans[feature]], 0 + ) ) self._attr_assumed_state |= any( state.attributes.get(ATTR_ASSUMED_STATE) for state in states diff --git a/homeassistant/components/homekit_controller/fan.py b/homeassistant/components/homekit_controller/fan.py index dffa323f8ad..550f86ddbe4 100644 --- a/homeassistant/components/homekit_controller/fan.py +++ b/homeassistant/components/homekit_controller/fan.py @@ -95,9 +95,9 @@ class BaseHomeKitFan(HomeKitEntity, FanEntity): return oscillating == 1 @property - def supported_features(self) -> FanEntityFeature | int: + def supported_features(self) -> FanEntityFeature: """Flag supported features.""" - features = 0 + features = FanEntityFeature(0) if self.service.has(CharacteristicsTypes.ROTATION_DIRECTION): features |= FanEntityFeature.DIRECTION diff --git a/homeassistant/components/mqtt/fan.py b/homeassistant/components/mqtt/fan.py index ef5386664f5..9da7721a7dc 100644 --- a/homeassistant/components/mqtt/fan.py +++ b/homeassistant/components/mqtt/fan.py @@ -334,7 +334,7 @@ class MqttFan(MqttEntity, FanEntity): optimistic or self._topic[CONF_PRESET_MODE_STATE_TOPIC] is None ) - self._attr_supported_features = 0 + self._attr_supported_features = FanEntityFeature(0) self._attr_supported_features |= ( self._topic[CONF_OSCILLATION_COMMAND_TOPIC] is not None and FanEntityFeature.OSCILLATE diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index a8d1eb16110..0ae157a694f 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1290,7 +1290,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ), TypeHintMatch( function_name="supported_features", - return_type=["FanEntityFeature", "int"], + return_type="FanEntityFeature", ), TypeHintMatch( function_name="set_percentage",