Fix Canary doing I/O in event loop (#44854)

pull/44869/head
Franck Nijhof 2021-01-05 20:55:17 +01:00 committed by GitHub
parent 35edc40537
commit 34161f3ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -127,11 +127,14 @@ class CanaryCamera(CoordinatorEntity, Camera):
async def async_camera_image(self):
"""Return a still image response from the camera."""
await self.hass.async_add_executor_job(self.renew_live_stream_session)
live_stream_url = await self.hass.async_add_executor_job(
getattr, self._live_stream_session, "live_stream_url"
)
ffmpeg = ImageFrame(self._ffmpeg.binary)
image = await asyncio.shield(
ffmpeg.get_image(
self._live_stream_session.live_stream_url,
live_stream_url,
output_format=IMAGE_JPEG,
extra_cmd=self._ffmpeg_arguments,
)