From c649eb1af0f8fa7bd149c4720d14f961419593b4 Mon Sep 17 00:00:00 2001 From: Maciej <38075949+maciej-or@users.noreply.github.com> Date: Tue, 25 Jul 2023 21:45:52 +0200 Subject: [PATCH] retry failed camera snapshot (#97) --- custom_components/hikvision_next/camera.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/hikvision_next/camera.py b/custom_components/hikvision_next/camera.py index 0d2b3cc..77c64d4 100644 --- a/custom_components/hikvision_next/camera.py +++ b/custom_components/hikvision_next/camera.py @@ -53,4 +53,8 @@ async def stream_source(self) -> str | None: async def async_camera_image(self, width: int | None = None, height: int | None = None) -> bytes | None: """Return a still image response from the camera.""" - return await self.isapi.get_camera_image(self.stream_info, width, height) + data = await self.isapi.get_camera_image(self.stream_info, width, height) + if data.startswith(b'