From cc5701d2f1bcb3635976bcf1f0196cd1ab9bb71e Mon Sep 17 00:00:00 2001 From: valentinfrlch Date: Tue, 22 Oct 2024 13:21:51 +0200 Subject: [PATCH] Fixes blocking call in add_videos --- custom_components/llmvision/media_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/llmvision/media_handlers.py b/custom_components/llmvision/media_handlers.py index 709c550..bb5c371 100644 --- a/custom_components/llmvision/media_handlers.py +++ b/custom_components/llmvision/media_handlers.py @@ -159,7 +159,7 @@ async def record_camera(image_entity, camera_number): f"Fetched {image_entity} in {fetch_duration:.2f} seconds") preprocessing_start_time = time.time() - img = Image.open(io.BytesIO(frame_data)) + img = await self.hass.loop.run_in_executor(None, Image.open, io.BytesIO(frame_data)) current_frame_gray = np.array(img.convert('L')) if previous_frame is not None: