Stop probing every href for Pattern B/C subdevice fallback (issue #265)
When /<uuid>/device/0 doesn't answer for a UUID-prefixed subdevice candidate, enumerate_subdevices used to fall back to probing every href the master answered that cycle individually under the prefix. Firmware that drops packets instead of 4.04ing (issue #265's ARTIK051_FAC_TIME_21K) turned that ~30-href loop into a ~300s hang at the default 10s RETRIEVE timeout, tripping Home Assistant's bootstrap-stage timeout and failing the whole config entry before the master device even finished setup. The fallback now trusts the device's own subdeviceIdList/oic_res-link claim outright instead of re-confirming it href by href: it clones the master's current hrefs and values verbatim under the prefix as the sibling's assumed state, with no extra RETRIEVEs. The existing per-summary-poll re-poll (_poll_subdevice_flat_hrefs) is unchanged and corrects the clone toward the sibling's real values as they're confirmed live; an href the firmware never answers under that prefix just keeps mirroring the master indefinitely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MuiJvThhi4WkNj2xb9xo8o
This commit is contained in:
8 files changed
+211
-191
No files matched your search
@@ -111,24 +111,26 @@ async def test_diagnostics_reports_prefixed_subdevice(
|
||||
assert diag["subdevices_skipped"] == []
|
||||
|
||||
|
||||
async def test_diagnostics_reports_flat_hrefs_for_skipped_prefixed_candidate(
|
||||
async def test_diagnostics_reports_flat_hrefs_for_materialized_prefixed_candidate(
|
||||
hass: HomeAssistant,
|
||||
enable_custom_integrations,
|
||||
) -> None:
|
||||
"""issue #205: a prefixed candidate found through the per-href flat
|
||||
"""issue #205: a prefixed candidate found through the clone-the-master
|
||||
fallback (no working /<uuid>/device/0 Collection) has no meaningful
|
||||
seed_path -- diagnostics reports None there instead of the misleading
|
||||
bare "/" an empty tuple would otherwise join to, and lists the actual
|
||||
hrefs the fallback confirmed instead."""
|
||||
bare "/" an empty tuple would otherwise join to, and lists the full set
|
||||
of hrefs the fallback assumed (issue #265 -- every href the master
|
||||
itself has, not just a confirmed few) instead."""
|
||||
coordinator = _coordinator(hass)
|
||||
await _discover(coordinator, "airconditioner_fac_bora_205_flat")
|
||||
hass.data.setdefault(DOMAIN, {})[coordinator._entry.entry_id] = coordinator
|
||||
|
||||
diag = await async_get_config_entry_diagnostics(hass, coordinator._entry)
|
||||
|
||||
assert diag["subdevices"] == []
|
||||
assert len(diag["subdevices_skipped"]) == 1
|
||||
skipped = diag["subdevices_skipped"][0]
|
||||
assert skipped["kind"] == "prefixed"
|
||||
assert skipped["seed_path"] is None
|
||||
assert skipped["flat_hrefs"] == ["/information/vs/0"]
|
||||
assert diag["subdevices_skipped"] == []
|
||||
assert len(diag["subdevices"]) == 1
|
||||
subdevice = diag["subdevices"][0]
|
||||
assert subdevice["kind"] == "prefixed"
|
||||
assert subdevice["seed_path"] is None
|
||||
assert subdevice["flat_hrefs"] == sorted(diag["resources"])
|
||||
assert subdevice["bound_entity_count"] > 0
|
||||
Reference in new issue
Block a user