From ac005c70c2688917dbbcc0ae48b07f6f1a744c73 Mon Sep 17 00:00:00 2001 From: Nathan Spencer Date: Mon, 24 Nov 2025 05:27:49 +0000 Subject: [PATCH] Close cloud/MQTT clients if initial coordinator refresh fails. --- custom_components/oasis_mini/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/oasis_mini/__init__.py b/custom_components/oasis_mini/__init__.py index 8378047..5e286f2 100644 --- a/custom_components/oasis_mini/__init__.py +++ b/custom_components/oasis_mini/__init__.py @@ -110,7 +110,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: OasisDeviceConfigEntry) coordinator = OasisDeviceCoordinator(hass, cloud_client, mqtt_client) - await coordinator.async_config_entry_first_refresh() + try: + await coordinator.async_config_entry_first_refresh() + except Exception: + await mqtt_client.async_close() + await cloud_client.async_close() + raise if entry.unique_id != (user_id := str(user["id"])): hass.config_entries.async_update_entry(entry, unique_id=user_id)