mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +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
|
import asyncio
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Awaitable
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
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:
|
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)
|
controller_data: ControllerData = get_controller_data(hass, config_entry)
|
||||||
|
await asyncio.gather(
|
||||||
tasks: list[Awaitable] = [
|
*(
|
||||||
hass.config_entries.async_forward_entry_unload(config_entry, platform)
|
hass.config_entries.async_unload_platforms(
|
||||||
for platform in get_configured_platforms(controller_data)
|
config_entry, get_configured_platforms(controller_data)
|
||||||
]
|
),
|
||||||
tasks.append(hass.async_add_executor_job(controller_data.controller.stop))
|
hass.async_add_executor_job(controller_data.controller.stop),
|
||||||
await asyncio.gather(*tasks)
|
)
|
||||||
|
)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user