From 5a4a1a250d88889f98a9abbdca29173e2bb3e925 Mon Sep 17 00:00:00 2001 From: Tobias Sauerwein Date: Wed, 23 Jun 2021 14:56:20 +0200 Subject: [PATCH] Catch exception for failed webhook drop for netatmo (#52119) --- homeassistant/components/netatmo/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/netatmo/__init__.py b/homeassistant/components/netatmo/__init__.py index 8158c23742f..d92e50107c9 100644 --- a/homeassistant/components/netatmo/__init__.py +++ b/homeassistant/components/netatmo/__init__.py @@ -131,7 +131,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: {"type": "None", "data": {WEBHOOK_PUSH_TYPE: WEBHOOK_DEACTIVATION}}, ) webhook_unregister(hass, entry.data[CONF_WEBHOOK_ID]) - await hass.data[DOMAIN][entry.entry_id][AUTH].async_dropwebhook() + try: + await hass.data[DOMAIN][entry.entry_id][AUTH].async_dropwebhook() + except pyatmo.ApiError: + _LOGGER.debug( + "No webhook to be dropped for %s", entry.data[CONF_WEBHOOK_ID] + ) async def register_webhook(event): if CONF_WEBHOOK_ID not in entry.data: