mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Identify cameras in error logs for generic and mjpeg cameras (#33561)
This commit is contained in:
parent
ae22b5187a
commit
d1c1aa518d
@ -132,7 +132,9 @@ class GenericCamera(Camera):
|
|||||||
)
|
)
|
||||||
return response.content
|
return response.content
|
||||||
except requests.exceptions.RequestException as error:
|
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
|
return self._last_image
|
||||||
|
|
||||||
self._last_image = await self.hass.async_add_job(fetch)
|
self._last_image = await self.hass.async_add_job(fetch)
|
||||||
@ -146,10 +148,12 @@ class GenericCamera(Camera):
|
|||||||
response = await websession.get(url, auth=self._auth)
|
response = await websession.get(url, auth=self._auth)
|
||||||
self._last_image = await response.read()
|
self._last_image = await response.read()
|
||||||
except asyncio.TimeoutError:
|
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
|
return self._last_image
|
||||||
except aiohttp.ClientError as err:
|
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
|
return self._last_image
|
||||||
|
|
||||||
self._last_url = url
|
self._last_url = url
|
||||||
|
@ -122,10 +122,10 @@ class MjpegCamera(Camera):
|
|||||||
return image
|
return image
|
||||||
|
|
||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
_LOGGER.error("Timeout getting camera image")
|
_LOGGER.error("Timeout getting camera image from %s", self._name)
|
||||||
|
|
||||||
except aiohttp.ClientError as err:
|
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):
|
def camera_image(self):
|
||||||
"""Return a still image response from the camera."""
|
"""Return a still image response from the camera."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user