mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Switch mqtt to use async_unload_platforms (#118097)
This commit is contained in:
parent
b58e0331cf
commit
3f76b865fa
@ -522,24 +522,13 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
mqtt_client = mqtt_data.client
|
mqtt_client = mqtt_data.client
|
||||||
|
|
||||||
# Unload publish and dump services.
|
# Unload publish and dump services.
|
||||||
hass.services.async_remove(
|
hass.services.async_remove(DOMAIN, SERVICE_PUBLISH)
|
||||||
DOMAIN,
|
hass.services.async_remove(DOMAIN, SERVICE_DUMP)
|
||||||
SERVICE_PUBLISH,
|
|
||||||
)
|
|
||||||
hass.services.async_remove(
|
|
||||||
DOMAIN,
|
|
||||||
SERVICE_DUMP,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Stop the discovery
|
# Stop the discovery
|
||||||
await discovery.async_stop(hass)
|
await discovery.async_stop(hass)
|
||||||
# Unload the platforms
|
# Unload the platforms
|
||||||
await asyncio.gather(
|
await hass.config_entries.async_unload_platforms(entry, mqtt_data.platforms_loaded)
|
||||||
*(
|
|
||||||
hass.config_entries.async_forward_entry_unload(entry, component)
|
|
||||||
for component in mqtt_data.platforms_loaded
|
|
||||||
)
|
|
||||||
)
|
|
||||||
mqtt_data.platforms_loaded = set()
|
mqtt_data.platforms_loaded = set()
|
||||||
await asyncio.sleep(0)
|
await asyncio.sleep(0)
|
||||||
# Unsubscribe reload dispatchers
|
# Unsubscribe reload dispatchers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user