Add device support for dual-cavity range TP1X_DA-KS-RANGE-0101X (issue #324)

This board (NE63T8751SG/AA-class) reports no /information/vs/0 at all --
the modelNum-based routing fallback has nothing to read -- so it fell
back to 'unknown' and lost the whole range registry (oven mode/setpoint/
door/connected, cooktop monitoring). /oic/d does carry oic.d.range,
though, so this is a routing fix, not a new capability: adds 'oic.d.range'
to _OIC_TYPE_TO_KEY.

The second oven cavity is a genuine Pattern A indexed subdevice at
/device/1 (issue #177's mechanism) -- once routing resolves the master to
the range registry, the same registry already applies to the subdevice's
canonical view and every href on both binds with zero gaps.

_discover_full gains an optional device_types param (default (), every
other fixture unaffected) so a fixture that can only route via /oic/d can
exercise the same subdevice-aware pipeline the other composite fixtures
already do.
This commit is contained in:
Marc Billow committed 2026-08-09 00:58:26 +00:00
1 parent b6f0bc22cb
commit 5e2c23a62d
6 files changed
+631 -3

No files matched your search

+21 -2
View File
@@ -1132,12 +1132,16 @@ def test_registry_reproduces_golden_state_keys_for_airconditioner_fac_bora():
)
def _new_subdevice_aware_state_keys(name):
def _new_subdevice_aware_state_keys(name, device_types=()):
"""Like _new_state_keys, but runs the full subdevice-aware pipeline
(enumerate_subdevices + discover_partitioned, issue #177) instead of a
single discover() call, so the golden for a composite-device fixture
captures every materialized subdevice's keys
(subdevice1_-/subdevice_<uuid>_-prefixed), not just the master's."""
(subdevice1_-/subdevice_<uuid>_-prefixed), not just the master's.
`device_types` threads through to discover_partitioned's own
`oic_device_types` -- needed for a board with no /information/vs/0 at
all to route from (issue #324's range)."""
from custom_components.localthings.registry.adapter import flatten
from tests.conftest import _discover_full, _load_device_full
@@ -1146,6 +1150,7 @@ def _new_subdevice_aware_state_keys(name):
resources,
oic_res,
seeds,
device_types,
)
state = flatten(bound, full_resources)
return sorted(state.keys())
@@ -1465,6 +1470,20 @@ def test_registry_reproduces_golden_state_keys_for_refrigerator_winecellar():
)
def test_registry_reproduces_golden_state_keys_for_range_tp1x_da_ks_range_0101x():
"""Dual-cavity range (issue #324): no /information/vs/0 at all, so
routing depends entirely on /oic/d's oic.d.range -- and the second
cavity is a genuine Pattern A indexed subdevice at /device/1."""
name = "range_tp1x_da_ks_range_0101x"
golden = json.loads((GOLDEN / f"{name}.json").read_text())
state_keys = _new_subdevice_aware_state_keys(name, device_types=("oic.wk.d", "oic.d.range"))
assert set(state_keys) == set(golden["state_keys"]), (
f"state_keys mismatch:\n"
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
)
def test_resources_from_batch_preferred_over_flat():
from tests.conftest import _resources_from_dump