Clean up unloads (#51688)

pull/51700/head
tkdrob 2021-06-10 03:56:35 -04:00 committed by GitHub
parent b1022ce84e
commit 181a4519b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 20 deletions

View File

@ -1,7 +1,6 @@
"""The Modern Forms integration."""
from __future__ import annotations
import asyncio
from datetime import timedelta
import logging
@ -63,16 +62,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload Modern Forms config entry."""
# Unload entities for this entry/device.
unload_ok = all(
await asyncio.gather(
*(
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
)
)
)
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
del hass.data[DOMAIN][entry.entry_id]

View File

@ -1,5 +1,4 @@
"""The Wallbox integration."""
import asyncio
from datetime import timedelta
import logging
@ -115,14 +114,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Unload a config entry."""
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN]["connections"].pop(entry.entry_id)