1
0
mirror of https://github.com/natekspencer/hacs-oasis_mini.git synced 2025-12-06 18:44:14 -05:00

Close cloud/MQTT clients if initial coordinator refresh fails.

This commit is contained in:
Nathan Spencer
2025-11-24 05:27:49 +00:00
parent 873d2d4bb0
commit ac005c70c2

View File

@@ -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)