Fix onvif snapshot fallback (#79394)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
uvjustin 2022-10-01 09:28:15 -07:00 committed by GitHub
parent f1f01429f4
commit 82af726e21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -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(