diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index 0b103c6a4ff4e..51e874ef3b73f 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -429,7 +429,7 @@ class Camera(Entity): _attr_motion_detection_enabled: bool = False _attr_should_poll: bool = False # No need to poll cameras _attr_state: None = None # State is determined by is_on - _attr_supported_features: CameraEntityFeature | int = 0 + _attr_supported_features: CameraEntityFeature = CameraEntityFeature(0) def __init__(self) -> None: """Initialize a camera.""" @@ -450,7 +450,7 @@ def entity_picture(self) -> str: return ENTITY_IMAGE_URL.format(self.entity_id, self.access_tokens[-1]) @property - def supported_features(self) -> CameraEntityFeature | int: + def supported_features(self) -> CameraEntityFeature: """Flag supported features.""" return self._attr_supported_features diff --git a/homeassistant/components/nest/camera_sdm.py b/homeassistant/components/nest/camera_sdm.py index f83f914385e39..f0b9b4930e1c6 100644 --- a/homeassistant/components/nest/camera_sdm.py +++ b/homeassistant/components/nest/camera_sdm.py @@ -95,9 +95,9 @@ def model(self) -> str | None: return self._device_info.device_model @property - def supported_features(self) -> int: + def supported_features(self) -> CameraEntityFeature: """Flag supported features.""" - supported_features = 0 + supported_features = CameraEntityFeature(0) if CameraLiveStreamTrait.NAME in self._device.traits: supported_features |= CameraEntityFeature.STREAM return supported_features diff --git a/homeassistant/components/unifiprotect/camera.py b/homeassistant/components/unifiprotect/camera.py index 5f858614acee5..00dbbe77e77c2 100644 --- a/homeassistant/components/unifiprotect/camera.py +++ b/homeassistant/components/unifiprotect/camera.py @@ -175,9 +175,10 @@ def _async_set_stream_source(self) -> None: self._stream_source = ( # pylint: disable=attribute-defined-outside-init None if disable_stream else rtsp_url ) - self._attr_supported_features = ( - CameraEntityFeature.STREAM if self._stream_source else 0 - ) + if self._stream_source: + self._attr_supported_features = CameraEntityFeature.STREAM + else: + self._attr_supported_features = CameraEntityFeature(0) @callback def _async_update_device_from_protect(self, device: ProtectModelWithId) -> None: diff --git a/homeassistant/components/uvc/camera.py b/homeassistant/components/uvc/camera.py index 28a221fd13111..2417908ecec98 100644 --- a/homeassistant/components/uvc/camera.py +++ b/homeassistant/components/uvc/camera.py @@ -107,14 +107,14 @@ def name(self): return self._name @property - def supported_features(self) -> CameraEntityFeature | int: + def supported_features(self) -> CameraEntityFeature: """Return supported features.""" channels = self._caminfo["channels"] for channel in channels: if channel["isRtspEnabled"]: return CameraEntityFeature.STREAM - return 0 + return CameraEntityFeature(0) @property def extra_state_attributes(self): diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 9c7a7798893cd..f03f9f111862f 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -803,7 +803,7 @@ class ClassTypeHintMatch: ), TypeHintMatch( function_name="supported_features", - return_type=["CameraEntityFeature", "int"], + return_type="CameraEntityFeature", ), TypeHintMatch( function_name="is_recording",