From 46a36adf268442f55266b069db22bacac81c29fd Mon Sep 17 00:00:00 2001 From: 0bmay <57501269+0bmay@users.noreply.github.com> Date: Fri, 6 May 2022 08:00:48 -0700 Subject: [PATCH] Fix Canary camera stream blocking call (#71369) * fix: Canary stream camera, fix blocker fixes a "detected blocking call to putrequest inside the event loop. This is causing stability issues. Please report issue for canary doing blocking calls at homeassistant/components/canary/camera.py, line 149: self._live_stream_session.live_stream_url, extra_cmd=self._ffmpeg_arguments" from log file. * refactor: black formatting changes tsia --- homeassistant/components/canary/camera.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/canary/camera.py b/homeassistant/components/canary/camera.py index 46826d80291..5caae6f5cc5 100644 --- a/homeassistant/components/canary/camera.py +++ b/homeassistant/components/canary/camera.py @@ -144,10 +144,11 @@ class CanaryCamera(CoordinatorEntity[CanaryDataUpdateCoordinator], Camera): if self._live_stream_session is None: return None - stream = CameraMjpeg(self._ffmpeg.binary) - await stream.open_camera( - self._live_stream_session.live_stream_url, extra_cmd=self._ffmpeg_arguments + live_stream_url = await self.hass.async_add_executor_job( + getattr, self._live_stream_session, "live_stream_url" ) + stream = CameraMjpeg(self._ffmpeg.binary) + await stream.open_camera(live_stream_url, extra_cmd=self._ffmpeg_arguments) try: stream_reader = await stream.get_reader()