Fix uncaught Blink exceptions (#69770)
This commit is contained in:
@@ -3,6 +3,8 @@ from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
||||
from requests.exceptions import ChunkedEncodingError
|
||||
|
||||
from homeassistant.components.camera import Camera
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -85,4 +87,11 @@ class BlinkCamera(Camera):
|
||||
self, width: int | None = None, height: int | None = None
|
||||
) -> bytes | None:
|
||||
"""Return a still image response from the camera."""
|
||||
return self._camera.image_from_cache.content
|
||||
try:
|
||||
return self._camera.image_from_cache.content
|
||||
except ChunkedEncodingError:
|
||||
_LOGGER.debug("Could not retrieve image for %s", self._camera.name)
|
||||
return None
|
||||
except TypeError:
|
||||
_LOGGER.debug("No cached image for %s", self._camera.name)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user