Fix i/o in august camera async image update (#32044)

* Fix i/o in august camera image update

* Address review comments
pull/32211/head
J. Nick Koston 2020-02-21 00:39:07 -06:00 committed by Paulus Schoutsen
parent a3b3ff52fc
commit cc8430ebed
1 changed files with 8 additions and 3 deletions

View File

@ -64,12 +64,17 @@ class AugustCamera(Camera):
if self._image_url is not latest.image_url:
self._image_url = latest.image_url
self._image_content = requests.get(
self._image_url, timeout=self._timeout
).content
self._image_content = await self.hass.async_add_executor_job(
self._camera_image
)
return self._image_content
def _camera_image(self):
"""Return bytes of camera image via http get."""
# Move this to py-august: see issue#32048
return requests.get(self._image_url, timeout=self._timeout).content
@property
def unique_id(self) -> str:
"""Get the unique id of the camera."""