Read from the cloud when the local status URL stops answering
The dongle has no DNS name and takes its address from DHCP, so a configured local /status URL goes stale when the lease changes. Setup treated that as fatal: every entity went unavailable and control (which never used the local path) went down with it. - A local URL that does not answer at setup no longer fails the entry; the coordinator subscribes to the cloud broker for telemetry instead and logs a warning. - After four consecutive failed local polls the coordinator switches to the cloud the same way, instead of holding the last local values forever. - When the local URL answers again it takes over: the cloud subscription is dropped along with what it delivered, so a stale cloud value cannot shadow a fresh local one. - New reconfigure step changes the local URL without signing in again. - Version 0.1.1. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
46a353071d
commit
3ba61e9c0b
7 files changed
+118
-7
No files matched your search
@@ -82,6 +82,34 @@ class HotSpringConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
step_id="user", data_schema=_schema(user_input), errors=errors
|
||||
)
|
||||
|
||||
async def async_step_reconfigure(
|
||||
self, user_input: dict[str, Any] | None = None
|
||||
) -> ConfigFlowResult:
|
||||
"""Change the local ``/status`` URL without signing in again.
|
||||
|
||||
The dongle takes its address from DHCP, so this is the one setting that
|
||||
goes stale on its own.
|
||||
"""
|
||||
entry = self._get_reconfigure_entry()
|
||||
if user_input is not None:
|
||||
url = (user_input.get(CONF_LOCAL_STATUS_URL) or "").strip()
|
||||
return self.async_update_reload_and_abort(
|
||||
entry, data_updates={CONF_LOCAL_STATUS_URL: url}
|
||||
)
|
||||
return self.async_show_form(
|
||||
step_id="reconfigure",
|
||||
data_schema=vol.Schema(
|
||||
{
|
||||
vol.Optional(
|
||||
CONF_LOCAL_STATUS_URL,
|
||||
description={
|
||||
"suggested_value": entry.data.get(CONF_LOCAL_STATUS_URL, "")
|
||||
},
|
||||
): str,
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
async def _validate(self, data: dict[str, Any]) -> str | None:
|
||||
"""Return None on success, or an error key."""
|
||||
cert_dir = data[CONF_CERT_DIR]
|
||||
|
||||
Reference in new issue
Block a user