Handle connection errors talking to UVC cameras during image fetch
This requires uvcclient==0.6 which breaks out exceptions for us. Fixes #1244
This commit is contained in:
parent
3ced457089
commit
263839a336
2 changed files with 11 additions and 4 deletions
|
@ -14,7 +14,7 @@ import requests
|
|||
from homeassistant.helpers import validate_config
|
||||
from homeassistant.components.camera import DOMAIN, Camera
|
||||
|
||||
REQUIREMENTS = ['uvcclient==0.5']
|
||||
REQUIREMENTS = ['uvcclient==0.6']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -82,10 +82,17 @@ class UnifiVideoCamera(Camera):
|
|||
dict(name=self._name, addr=addr))
|
||||
except socket.error:
|
||||
pass
|
||||
except uvc_camera.CameraConnectError:
|
||||
pass
|
||||
except uvc_camera.CameraAuthError:
|
||||
pass
|
||||
|
||||
if not camera:
|
||||
_LOGGER.error('Unable to login to camera')
|
||||
return None
|
||||
|
||||
camera.login()
|
||||
return camera.get_snapshot()
|
||||
try:
|
||||
camera.login()
|
||||
return camera.get_snapshot()
|
||||
except uvc_camera.CameraConnectError:
|
||||
_LOGGER.error('Failed to connect to camera %s', self._name)
|
||||
|
|
|
@ -249,7 +249,7 @@ tellive-py==0.5.2
|
|||
transmissionrpc==0.11
|
||||
|
||||
# homeassistant.components.camera.uvc
|
||||
uvcclient==0.5
|
||||
uvcclient==0.6
|
||||
|
||||
# homeassistant.components.verisure
|
||||
vsure==0.5.0
|
||||
|
|
Loading…
Add table
Reference in a new issue