Mute superfluous exception when no Netatmo webhook is to be dropped (#81221)

* Mute superfluous exception when no webhook is to be droped

* Update homeassistant/components/netatmo/__init__.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Tobias Sauerwein 2022-10-30 00:04:01 +02:00 committed by GitHub
parent b043406b74
commit f10b36873a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -271,7 +271,10 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if CONF_WEBHOOK_ID in entry.data:
webhook_unregister(hass, entry.data[CONF_WEBHOOK_ID])
await data[entry.entry_id][AUTH].async_dropwebhook()
try:
await data[entry.entry_id][AUTH].async_dropwebhook()
except pyatmo.ApiError:
_LOGGER.debug("No webhook to be dropped")
_LOGGER.info("Unregister Netatmo webhook")
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)