diff --git a/homeassistant/components/onvif/camera.py b/homeassistant/components/onvif/camera.py index 6c76f98a8da..9a8535f2599 100644 --- a/homeassistant/components/onvif/camera.py +++ b/homeassistant/components/onvif/camera.py @@ -142,16 +142,21 @@ class ONVIFCameraEntity(ONVIFBaseEntity, Camera): if self.device.capabilities.snapshot: try: - image = await self.device.device.get_snapshot( + if image := await self.device.device.get_snapshot( self.profile.token, self._basic_auth - ) - return image + ): + return image except ONVIFError as err: LOGGER.error( "Fetch snapshot image failed from %s, falling back to FFmpeg; %s", self.device.name, err, ) + else: + LOGGER.error( + "Fetch snapshot image failed from %s, falling back to FFmpeg", + self.device.name, + ) assert self._stream_uri return await ffmpeg.async_get_image(