Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions homeassistant/components/generic/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ def fetch():
)
return response.content
except requests.exceptions.RequestException as error:
_LOGGER.error("Error getting camera image: %s", error)
_LOGGER.error(
"Error getting new camera image from %s: %s", self._name, error
)
return self._last_image

self._last_image = await self.hass.async_add_job(fetch)
Expand All @@ -146,10 +148,12 @@ def fetch():
response = await websession.get(url, auth=self._auth)
self._last_image = await response.read()
except asyncio.TimeoutError:
_LOGGER.error("Timeout getting image from: %s", self._name)
_LOGGER.error("Timeout getting camera image from %s", self._name)
return self._last_image
except aiohttp.ClientError as err:
_LOGGER.error("Error getting new camera image: %s", err)
_LOGGER.error(
"Error getting new camera image from %s: %s", self._name, err
)
return self._last_image

self._last_url = url
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/mjpeg/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ async def async_camera_image(self):
return image

except asyncio.TimeoutError:
_LOGGER.error("Timeout getting camera image")
_LOGGER.error("Timeout getting camera image from %s", self._name)

except aiohttp.ClientError as err:
_LOGGER.error("Error getting new camera image: %s", err)
_LOGGER.error("Error getting new camera image from %s: %s", self._name, err)

def camera_image(self):
"""Return a still image response from the camera."""
Expand Down