Fix onvif snapshot fallback (#79394)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
pull/79642/head
uvjustin 2022-10-01 09:28:15 -07:00 committed by Paulus Schoutsen
parent a0ba102492
commit ebb213eb14
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(