Catch exception for failed webhook drop for netatmo (#52119)

This commit is contained in:
Tobias Sauerwein 2021-06-23 14:56:20 +02:00 committed by GitHub
parent b3b23066a8
commit 5a4a1a250d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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