From cefd4f56b1b0f31953a5507ddb6481ca336d9b52 Mon Sep 17 00:00:00 2001 From: Zachary Knight Date: Mon, 16 Sep 2024 15:37:19 -0400 Subject: [PATCH] Fix reloading the integration from hanging (#192) * fix reloading entities * bump * Fix conflict from main merge --------- Co-authored-by: Ben Vezzani --- custom_components/dyson_local/__init__.py | 17 ++++++----------- custom_components/dyson_local/manifest.json | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/custom_components/dyson_local/__init__.py b/custom_components/dyson_local/__init__.py index 21db41b..fcf1957 100644 --- a/custom_components/dyson_local/__init__.py +++ b/custom_components/dyson_local/__init__.py @@ -178,21 +178,16 @@ def stop_discovery(_): async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Unload Dyson local.""" - device = hass.data[DOMAIN][DATA_DEVICES][entry.entry_id] - ok = all( - await asyncio.gather( - *[ - hass.config_entries.async_forward_entry_unload(entry, component) - for component in _async_get_platforms(device) - ] - ) - ) - if ok: + device: DysonDevice = hass.data[DOMAIN][DATA_DEVICES][entry.entry_id] + + unload_ok = await hass.config_entries.async_unload_platforms(entry, _async_get_platforms(device)) + + if unload_ok: hass.data[DOMAIN][DATA_DEVICES].pop(entry.entry_id) hass.data[DOMAIN][DATA_COORDINATORS].pop(entry.entry_id) await hass.async_add_executor_job(device.disconnect) # TODO: stop discovery - return ok + return unload_ok @callback diff --git a/custom_components/dyson_local/manifest.json b/custom_components/dyson_local/manifest.json index a91cda8..da67bd3 100644 --- a/custom_components/dyson_local/manifest.json +++ b/custom_components/dyson_local/manifest.json @@ -8,5 +8,5 @@ "import_executor": true, "iot_class": "local_push", "issue_tracker": "https://github.com/libdyson-wg/ha-dyson/issues", - "version": "1.4.1" + "version": "1.4.2" }