Reduce config entry setup/unload boilerplate K-M (#49775)

This commit is contained in:
J. Nick Koston 2021-04-27 06:49:13 -10:00 committed by GitHub
parent b5cb9e4ade
commit b10534359b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 104 additions and 352 deletions

View file

@ -225,14 +225,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""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:
config_data = hass.data[DOMAIN].pop(entry.entry_id)
await config_data[CONF_CLIENT].async_client_close()