@@ -229,24 +229,21 @@ def _handle_entity_registry_updated(event):
229229
230230async def async_unload_entry (hass : HomeAssistant , entry : ConfigEntry ) -> bool :
231231 """Unload a config entry."""
232- # Only unload platforms that were successfully loaded
233232 if entry .entry_id in hass .data .get (DOMAIN , {}):
234233 entry_data = hass .data [DOMAIN ][entry .entry_id ]
235- loaded_platforms = entry_data .get ("loaded_platforms" , set ())
236234
237- LOGGER .debug ("Unloading entry: %s with loaded platforms: %s" , entry .entry_id , loaded_platforms )
235+ LOGGER .debug ("Unloading entry: %s with platforms: %s" , entry .entry_id , PLATFORMS )
238236
239237 # Unregister coordinator from services
240238 if "services" in hass .data [DOMAIN ] and "unregister_coordinator" in hass .data [DOMAIN ]["services" ]:
241239 LOGGER .debug ("Unregistering coordinator for entry: %s" , entry .entry_id )
242240 unregister_coordinator = hass .data [DOMAIN ]["services" ]["unregister_coordinator" ]
243241 unregister_coordinator (entry .entry_id )
244242
245- # Attempt to unload all platforms at once
246243 try :
247- unload_ok = await hass .config_entries .async_unload_platforms (entry , loaded_platforms )
244+ unload_ok = await hass .config_entries .async_unload_platforms (entry , PLATFORMS )
248245 if not unload_ok :
249- LOGGER .warning ("Failed to unload one or more platforms: %s" , loaded_platforms )
246+ LOGGER .warning ("Failed to unload one or more platforms: %s" , PLATFORMS )
250247 except Exception as unload_error :
251248 LOGGER .exception ("Error unloading platforms: %s" , unload_error )
252249 unload_ok = False
0 commit comments