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" }