Bump amcrest to 1.2.6 & use new exceptions (#22040)
* Bump amcrest to 1.2.6 & use new exceptions * Fix lint failure * Use AmcrestError instead of individual ones
This commit is contained in:
1 parent
4e84e8a15e
commit
8d2d71c16a
3 files changed
+9
-10
No files matched your search
@@ -4,8 +4,6 @@ from datetime import timedelta
|
||||
|
||||
import aiohttp
|
||||
import voluptuous as vol
|
||||
from requests.exceptions import HTTPError, ConnectTimeout
|
||||
from requests.exceptions import ConnectionError as ConnectError
|
||||
|
||||
from homeassistant.const import (
|
||||
CONF_NAME, CONF_HOST, CONF_PORT, CONF_USERNAME, CONF_PASSWORD,
|
||||
@@ -13,7 +11,8 @@ from homeassistant.const import (
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['amcrest==1.2.5']
|
||||
|
||||
REQUIREMENTS = ['amcrest==1.2.6']
|
||||
DEPENDENCIES = ['ffmpeg']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -91,7 +90,7 @@ CONFIG_SCHEMA = vol.Schema({
|
||||
|
||||
def setup(hass, config):
|
||||
"""Set up the Amcrest IP Camera component."""
|
||||
from amcrest import AmcrestCamera
|
||||
from amcrest import AmcrestCamera, AmcrestError
|
||||
|
||||
hass.data[DATA_AMCREST] = {}
|
||||
amcrest_cams = config[DOMAIN]
|
||||
@@ -105,7 +104,7 @@ def setup(hass, config):
|
||||
# pylint: disable=pointless-statement
|
||||
camera.current_time
|
||||
|
||||
except (ConnectError, ConnectTimeout, HTTPError) as ex:
|
||||
except AmcrestError as ex:
|
||||
_LOGGER.error("Unable to connect to Amcrest camera: %s", str(ex))
|
||||
hass.components.persistent_notification.create(
|
||||
'Error: {}<br />'
|
||||
|
||||
Reference in new issue
Block a user