Skip to content

Commit d297221

Browse files
author
Ted Roberts
committed
Fix config entry reload state handling and setup resilience (v0.2.31)
1 parent 1d42ab7 commit d297221

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

custom_components/novastar_h/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
8181
coordinator = NovastarCoordinator(
8282
hass, entry, client, device_id=device_id, screen_id=screen_id
8383
)
84-
await coordinator.async_config_entry_first_refresh()
84+
try:
85+
await coordinator.async_config_entry_first_refresh()
86+
except Exception:
87+
_LOGGER.warning(
88+
"Initial refresh failed for entry %s; continuing setup with unavailable entities",
89+
entry.entry_id,
90+
exc_info=True,
91+
)
8592

8693
hass.data[DOMAIN][entry.entry_id] = {
8794
"client": client,
@@ -236,5 +243,4 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
236243

237244
async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
238245
"""Reload config entry."""
239-
await async_unload_entry(hass, entry)
240-
await async_setup_entry(hass, entry)
246+
await hass.config_entries.async_reload(entry.entry_id)

custom_components/novastar_h/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
}
2222
],
2323
"zeroconf": ["_novastar._tcp.local."],
24-
"version": "0.2.30"
24+
"version": "0.2.31"
2525
}

0 commit comments

Comments
 (0)