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:
Dan Smith 2016-02-14 16:36:51 +00:00
parent 3ced457089
commit 263839a336
2 changed files with 11 additions and 4 deletions

View file

@ -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)

View file

@ -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