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

This commit is contained in:
Franck Nijhof 2021-01-05 20:55:17 +01:00
parent fdce5878c6
commit 2ee50a4d54
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

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,
)