diff --git a/homeassistant/components/acmeda/cover.py b/homeassistant/components/acmeda/cover.py index fba538a7a70..15a20cf6932 100644 --- a/homeassistant/components/acmeda/cover.py +++ b/homeassistant/components/acmeda/cover.py @@ -70,9 +70,9 @@ class AcmedaCover(AcmedaBase, CoverEntity): return position @property - def supported_features(self) -> CoverEntityFeature | int: + def supported_features(self) -> CoverEntityFeature: """Flag supported features.""" - supported_features = 0 + supported_features = CoverEntityFeature(0) if self.current_cover_position is not None: supported_features |= ( CoverEntityFeature.OPEN diff --git a/homeassistant/components/bond/cover.py b/homeassistant/components/bond/cover.py index 0a3e9048451..a41e188ed9d 100644 --- a/homeassistant/components/bond/cover.py +++ b/homeassistant/components/bond/cover.py @@ -58,7 +58,7 @@ class BondCover(BondEntity, CoverEntity): ) -> None: """Create HA entity representing Bond cover.""" super().__init__(hub, device, bpup_subs) - supported_features = 0 + supported_features = CoverEntityFeature(0) if self._device.supports_set_position(): supported_features |= CoverEntityFeature.SET_POSITION if self._device.supports_open(): diff --git a/homeassistant/components/cover/__init__.py b/homeassistant/components/cover/__init__.py index 37cdc6422ad..072710aa947 100644 --- a/homeassistant/components/cover/__init__.py +++ b/homeassistant/components/cover/__init__.py @@ -232,7 +232,7 @@ class CoverEntity(Entity): _attr_is_closing: bool | None = None _attr_is_opening: bool | None = None _attr_state: None = None - _attr_supported_features: CoverEntityFeature | int | None + _attr_supported_features: CoverEntityFeature | None _cover_is_last_toggle_direction_open = True @@ -292,7 +292,7 @@ class CoverEntity(Entity): return data @property - def supported_features(self) -> CoverEntityFeature | int: + def supported_features(self) -> CoverEntityFeature: """Flag supported features.""" if self._attr_supported_features is not None: return self._attr_supported_features diff --git a/homeassistant/components/group/cover.py b/homeassistant/components/group/cover.py index a867c92d956..2ecfbeaca42 100644 --- a/homeassistant/components/group/cover.py +++ b/homeassistant/components/group/cover.py @@ -324,7 +324,7 @@ class CoverGroup(GroupEntity, CoverEntity): tilt_states, ATTR_CURRENT_TILT_POSITION ) - supported_features = 0 + supported_features = CoverEntityFeature(0) if self._covers[KEY_OPEN_CLOSE]: supported_features |= CoverEntityFeature.OPEN | CoverEntityFeature.CLOSE supported_features |= CoverEntityFeature.STOP if self._covers[KEY_STOP] else 0 diff --git a/homeassistant/components/hunterdouglas_powerview/cover.py b/homeassistant/components/hunterdouglas_powerview/cover.py index 347b2c3af03..7e0206de322 100644 --- a/homeassistant/components/hunterdouglas_powerview/cover.py +++ b/homeassistant/components/hunterdouglas_powerview/cover.py @@ -118,7 +118,7 @@ class PowerViewShadeBase(ShadeEntity, CoverEntity): """Representation of a powerview shade.""" _attr_device_class = CoverDeviceClass.SHADE - _attr_supported_features = 0 + _attr_supported_features = CoverEntityFeature(0) def __init__( self, diff --git a/homeassistant/components/mqtt/cover.py b/homeassistant/components/mqtt/cover.py index c0bc92c42f5..533698d91b3 100644 --- a/homeassistant/components/mqtt/cover.py +++ b/homeassistant/components/mqtt/cover.py @@ -516,9 +516,9 @@ class MqttCover(MqttEntity, CoverEntity): return self._config.get(CONF_DEVICE_CLASS) @property - def supported_features(self) -> CoverEntityFeature | int: + def supported_features(self) -> CoverEntityFeature: """Flag supported features.""" - supported_features = 0 + supported_features = CoverEntityFeature(0) if self._config.get(CONF_COMMAND_TOPIC) is not None: if self._config.get(CONF_PAYLOAD_OPEN) is not None: supported_features |= CoverEntityFeature.OPEN diff --git a/homeassistant/components/overkiz/cover_entities/awning.py b/homeassistant/components/overkiz/cover_entities/awning.py index 07665c2a5c8..a5aee73bf5b 100644 --- a/homeassistant/components/overkiz/cover_entities/awning.py +++ b/homeassistant/components/overkiz/cover_entities/awning.py @@ -25,9 +25,9 @@ class Awning(OverkizGenericCover): _attr_device_class = CoverDeviceClass.AWNING @property - def supported_features(self) -> int: + def supported_features(self) -> CoverEntityFeature: """Flag supported features.""" - supported_features: int = super().supported_features + supported_features = super().supported_features if self.executor.has_command(OverkizCommand.SET_DEPLOYMENT): supported_features |= CoverEntityFeature.SET_POSITION diff --git a/homeassistant/components/overkiz/cover_entities/generic_cover.py b/homeassistant/components/overkiz/cover_entities/generic_cover.py index e36d7a680b1..1bc108b531d 100644 --- a/homeassistant/components/overkiz/cover_entities/generic_cover.py +++ b/homeassistant/components/overkiz/cover_entities/generic_cover.py @@ -129,9 +129,9 @@ class OverkizGenericCover(OverkizEntity, CoverEntity): return attr @property - def supported_features(self) -> int: + def supported_features(self) -> CoverEntityFeature: """Flag supported features.""" - supported_features = 0 + supported_features = CoverEntityFeature(0) if self.executor.has_command(*COMMANDS_OPEN_TILT): supported_features |= CoverEntityFeature.OPEN_TILT diff --git a/homeassistant/components/overkiz/cover_entities/vertical_cover.py b/homeassistant/components/overkiz/cover_entities/vertical_cover.py index 90ac6428960..1459786c23f 100644 --- a/homeassistant/components/overkiz/cover_entities/vertical_cover.py +++ b/homeassistant/components/overkiz/cover_entities/vertical_cover.py @@ -46,9 +46,9 @@ class VerticalCover(OverkizGenericCover): """Representation of an Overkiz vertical cover.""" @property - def supported_features(self) -> int: + def supported_features(self) -> CoverEntityFeature: """Flag supported features.""" - supported_features: int = super().supported_features + supported_features = super().supported_features if self.executor.has_command(OverkizCommand.SET_CLOSURE): supported_features |= CoverEntityFeature.SET_POSITION diff --git a/homeassistant/components/tuya/cover.py b/homeassistant/components/tuya/cover.py index d8b0a97480e..5bb9c794ca4 100644 --- a/homeassistant/components/tuya/cover.py +++ b/homeassistant/components/tuya/cover.py @@ -191,7 +191,7 @@ class TuyaCoverEntity(TuyaEntity, CoverEntity): super().__init__(device, device_manager) self.entity_description = description self._attr_unique_id = f"{super().unique_id}{description.key}" - self._attr_supported_features = 0 + self._attr_supported_features = CoverEntityFeature(0) # Check if this cover is based on a switch or has controls if self.find_dpcode(description.key, prefer_function=True): diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 78c21747948..a8d1eb16110 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1110,7 +1110,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ), TypeHintMatch( function_name="supported_features", - return_type=["CoverEntityFeature", "int"], + return_type="CoverEntityFeature", ), TypeHintMatch( function_name="open_cover",