mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Allow doorbird to still setup with missing operator permission (#64727)
This commit is contained in:
parent
b713a951dd
commit
b587e49300
@ -252,8 +252,11 @@ class ConfiguredDoorBird:
|
||||
if self.custom_url is not None:
|
||||
hass_url = self.custom_url
|
||||
|
||||
favorites = self.device.favorites()
|
||||
if not self.doorstation_events:
|
||||
# User may not have permission to get the favorites
|
||||
return
|
||||
|
||||
favorites = self.device.favorites()
|
||||
for event in self.doorstation_events:
|
||||
self._register_event(hass_url, event, favs=favorites)
|
||||
|
||||
@ -272,16 +275,16 @@ class ConfiguredDoorBird:
|
||||
url = f"{hass_url}{API_URL}/{event}?token={self._token}"
|
||||
|
||||
# Register HA URL as webhook if not already, then get the ID
|
||||
if not self.webhook_is_registered(url, favs=favs):
|
||||
self.device.change_favorite("http", f"Home Assistant ({event})", url)
|
||||
if self.webhook_is_registered(url, favs=favs):
|
||||
return
|
||||
|
||||
if not self.get_webhook_id(url, favs=favs):
|
||||
self.device.change_favorite("http", f"Home Assistant ({event})", url)
|
||||
if not self.webhook_is_registered(url):
|
||||
_LOGGER.warning(
|
||||
'Could not find favorite for URL "%s". ' 'Skipping sensor "%s"',
|
||||
url,
|
||||
event,
|
||||
)
|
||||
return
|
||||
|
||||
def webhook_is_registered(self, url, favs=None) -> bool:
|
||||
"""Return whether the given URL is registered as a device favorite."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user