From 3f76b865fa506a63ffedf0fe3d027c5bd83f4025 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 24 May 2024 23:55:36 -1000 Subject: [PATCH] Switch mqtt to use async_unload_platforms (#118097) --- homeassistant/components/mqtt/__init__.py | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 1e946421bcf..3391312bdd0 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -522,24 +522,13 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: mqtt_client = mqtt_data.client # Unload publish and dump services. - hass.services.async_remove( - DOMAIN, - SERVICE_PUBLISH, - ) - hass.services.async_remove( - DOMAIN, - SERVICE_DUMP, - ) + hass.services.async_remove(DOMAIN, SERVICE_PUBLISH) + hass.services.async_remove(DOMAIN, SERVICE_DUMP) # Stop the discovery await discovery.async_stop(hass) # Unload the platforms - await asyncio.gather( - *( - hass.config_entries.async_forward_entry_unload(entry, component) - for component in mqtt_data.platforms_loaded - ) - ) + await hass.config_entries.async_unload_platforms(entry, mqtt_data.platforms_loaded) mqtt_data.platforms_loaded = set() await asyncio.sleep(0) # Unsubscribe reload dispatchers