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:
@@ -110,7 +110,12 @@ async def async_setup_entry(hass: HomeAssistant, entry: OasisDeviceConfigEntry)
|
|||||||
|
|
||||||
coordinator = OasisDeviceCoordinator(hass, cloud_client, mqtt_client)
|
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"])):
|
if entry.unique_id != (user_id := str(user["id"])):
|
||||||
hass.config_entries.async_update_entry(entry, unique_id=user_id)
|
hass.config_entries.async_update_entry(entry, unique_id=user_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user