mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Show persistent notification on Doorbird schedule failure (#20033)
* Remove unnecessary return. Add persistent notification on failure to configure doorbird schedule. * Update doorbirdpy to 2.0.5 * Fix bare except * Bump version again * Lint * Return false
This commit is contained in:
parent
798f630029
commit
db87842335
@ -6,6 +6,7 @@ https://home-assistant.io/components/doorbird/
|
|||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from urllib.error import HTTPError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.http import HomeAssistantView
|
from homeassistant.components.http import HomeAssistantView
|
||||||
@ -14,7 +15,7 @@ from homeassistant.const import CONF_HOST, CONF_USERNAME, \
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.util import slugify, dt as dt_util
|
from homeassistant.util import slugify, dt as dt_util
|
||||||
|
|
||||||
REQUIREMENTS = ['doorbirdpy==2.0.4']
|
REQUIREMENTS = ['doorbirdpy==2.0.6']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -113,7 +114,18 @@ def setup(hass, config):
|
|||||||
|
|
||||||
# Subscribe to doorbell or motion events
|
# Subscribe to doorbell or motion events
|
||||||
if events:
|
if events:
|
||||||
doorstation.update_schedule(hass)
|
try:
|
||||||
|
doorstation.update_schedule(hass)
|
||||||
|
except HTTPError:
|
||||||
|
hass.components.persistent_notification.create(
|
||||||
|
'Doorbird configuration failed. Please verify that API '
|
||||||
|
'Operator permission is enabled for the Doorbird user. '
|
||||||
|
'A restart will be required once permissions have been '
|
||||||
|
'verified.',
|
||||||
|
title='Doorbird Configuration Failure',
|
||||||
|
notification_id='doorbird_schedule_error')
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
hass.data[DOMAIN] = doorstations
|
hass.data[DOMAIN] = doorstations
|
||||||
|
|
||||||
@ -230,6 +242,7 @@ class ConfiguredDoorBird():
|
|||||||
if not self.webhook_is_registered(hass_url):
|
if not self.webhook_is_registered(hass_url):
|
||||||
self.device.change_favorite('http', 'Home Assistant ({} events)'
|
self.device.change_favorite('http', 'Home Assistant ({} events)'
|
||||||
.format(event), hass_url)
|
.format(event), hass_url)
|
||||||
|
|
||||||
fav_id = self.get_webhook_id(hass_url)
|
fav_id = self.get_webhook_id(hass_url)
|
||||||
|
|
||||||
if not fav_id:
|
if not fav_id:
|
||||||
@ -253,8 +266,6 @@ class ConfiguredDoorBird():
|
|||||||
for relay in self._relay_nums:
|
for relay in self._relay_nums:
|
||||||
entry = self.device.get_schedule_entry(event, str(relay))
|
entry = self.device.get_schedule_entry(event, str(relay))
|
||||||
entry.output.append(output)
|
entry.output.append(output)
|
||||||
resp = self.device.change_schedule(entry)
|
|
||||||
return resp
|
|
||||||
else:
|
else:
|
||||||
entry = self.device.get_schedule_entry(event)
|
entry = self.device.get_schedule_entry(event)
|
||||||
entry.output.append(output)
|
entry.output.append(output)
|
||||||
|
@ -327,7 +327,7 @@ distro==1.3.0
|
|||||||
dlipower==0.7.165
|
dlipower==0.7.165
|
||||||
|
|
||||||
# homeassistant.components.doorbird
|
# homeassistant.components.doorbird
|
||||||
doorbirdpy==2.0.4
|
doorbirdpy==2.0.6
|
||||||
|
|
||||||
# homeassistant.components.sensor.dovado
|
# homeassistant.components.sensor.dovado
|
||||||
dovado==0.4.1
|
dovado==0.4.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user