Reduce config entry setup/unload boilerplate Q-S (#49778)
This commit is contained in:
parent
d2fd504442
commit
87420627a8
40 changed files with 119 additions and 436 deletions
|
@ -202,24 +202,14 @@ async def async_setup_entry(hass, entry: config_entries.ConfigEntry):
|
|||
)
|
||||
return False
|
||||
|
||||
for platform in PLATFORMS:
|
||||
hass.async_create_task(
|
||||
hass.config_entries.async_forward_entry_setup(entry, platform)
|
||||
)
|
||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass, entry: config_entries.ConfigEntry):
|
||||
"""Unload RFXtrx component."""
|
||||
if not all(
|
||||
await asyncio.gather(
|
||||
*[
|
||||
hass.config_entries.async_forward_entry_unload(entry, platform)
|
||||
for platform in PLATFORMS
|
||||
]
|
||||
)
|
||||
):
|
||||
if not await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
|
||||
return False
|
||||
|
||||
hass.services.async_remove(DOMAIN, SERVICE_SEND)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue