Skip to content

Commit

Permalink
fix: blocking in camera (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Jun 1, 2024
1 parent 1b95b97 commit a633b4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/mail_and_packages/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ async def async_camera_image(
) -> bytes | None:
"""Return image response."""
try:
with open(self._file_path, "rb") as file:
return file.read()
file = await self.hass.async_add_executor_job(open, self._file_path, "rb")
return file.read()
except FileNotFoundError:
_LOGGER.warning(
"Could not read camera %s image from file: %s",
Expand Down

0 comments on commit a633b4a

Please sign in to comment.