Fix ARTIK051_DONGLE_REF freezer type detection and door sensor (issue #77)

RZ32M713EWW/EE (an ARTIK051-dongle standalone freezer) reports no
oneUiVersion and a pipe-delimited modelNum
('ARTIK051_DONGLE_REF|<rest>') -- REF is the last underscore segment
before the pipe, not wrapped in underscores on both sides like the
'..._REF_...' shape for_device_by_model's substring check expected, so
the device fell through to 'unknown' with only common capabilities:
no door sensor, no temperature sensors, nothing fridge-specific.

Replace the substring check with a segment-based one
(_model_num_segments splits the pipe-delimited prefix on '_') that
catches both shapes. Same root cause, same fix, and same device family
independently reported and root-caused in issue #83 (which also covers
two further bugs -- config-flow/coordinator serial collisions on a
second symptom of this firmware, 'Nothing(SVC)' as a literal serial --
not needed here since this reporter has a single unit; left for #83).

Once routed to the refrigerator registry, fridge.py's existing pattern
capabilities pick up /temperature/current/freezer/0 and
/temperature/desired/freezer/0 for free -- they were never the actual
problem, just unreachable under the 'unknown' fallback (which never
tries pattern capabilities at all). The door sensor needed one more
fix: /door/onedoorfreezer/vs/0 reports the vendor-prefixed
x.com.samsung.da.openState, not the bare openState DOOR_GENERIC read,
so the entity existed but stayed permanently unavailable. Check both
field names via rep_fn.
This commit is contained in:
Marc Billow committed 2026-07-27 00:39:33 +00:00
1 parent aff7647460
commit 8194ea9e87
7 files changed
+348 -4

No files matched your search

+21
View File
@@ -166,6 +166,27 @@ def test_registry_reproduces_golden_state_keys_for_artik051_ref_17k():
)
def test_registry_reproduces_golden_state_keys_for_artik051_dongle_ref():
"""ARTIK051_DONGLE_REF standalone freezer (issues #77/#83) -- reports no
oneUiVersion and a pipe-delimited modelNum ('..._DONGLE_REF|<rest>')
that the old '_REF_' substring check missed entirely; resolved via the
segment-based check in for_device_by_model. Its door
(/door/onedoorfreezer/vs/0) and temperature
(/temperature/{current,desired}/freezer/0) hrefs only bind through
fridge.py's pattern capabilities, which the 'unknown' fallback never
tries -- so this also regression-tests that those resources bind at
all once routed to the right registry."""
from tests.conftest import _load_device
resources = _load_device('refrigerator_artik051_dongle_ref')
golden = json.loads((GOLDEN / 'refrigerator_artik051_dongle_ref.json').read_text())
state_keys = _new_state_keys('refrigerator_artik051_dongle_ref', resources)
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_registry_reproduces_golden_state_keys_for_tp2x_ref_20k():
"""TP2X_REF_20K -- CV_FDR_-prefixed flex zone (issue #32) plus the extra
energy fields (cumulativeConsumption/monthlyConsumption/