mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Migrate vera to use async_unload_platforms (#118099)
This commit is contained in:
parent
204cd376cb
commit
131c1807c4
@ -4,7 +4,6 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections import defaultdict
|
||||
from collections.abc import Awaitable
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
@ -157,16 +156,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
||||
|
||||
async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||
"""Unload Withings config entry."""
|
||||
"""Unload vera config entry."""
|
||||
controller_data: ControllerData = get_controller_data(hass, config_entry)
|
||||
|
||||
tasks: list[Awaitable] = [
|
||||
hass.config_entries.async_forward_entry_unload(config_entry, platform)
|
||||
for platform in get_configured_platforms(controller_data)
|
||||
]
|
||||
tasks.append(hass.async_add_executor_job(controller_data.controller.stop))
|
||||
await asyncio.gather(*tasks)
|
||||
|
||||
await asyncio.gather(
|
||||
*(
|
||||
hass.config_entries.async_unload_platforms(
|
||||
config_entry, get_configured_platforms(controller_data)
|
||||
),
|
||||
hass.async_add_executor_job(controller_data.controller.stop),
|
||||
)
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user