fix: fridge/washer coverage gaps from the #19-#27 dump batch
Six new diagnostics dumps, six gaps closed: - refrigerator: bind /diagnosis/vs/0 (reuse dishwasher.DIAGNOSIS -- same shape) into the refrigerator registry; it was never wired up there, tripping the coverage repair on any fridge that reports it (#20, #26). - refrigerator: add PANTRY_ZONE for the Cool Select Zone pantry compartment (/status/pantry/one/vs/0, x.com.samsung.da.mode/supportedOptions) -- same shape as BEVERAGE_ZONE but a distinct resource/field set (#20). - refrigerator: generalize FLEX_ZONE to identify the current mode by list membership in supportedOptions instead of a hardcoded CV_TTYPE_RF9000A_ prefix check. TP1X/Bespoke-class fridges use a CV_FDR_ prefix instead, which the old code didn't recognize -- the select existed but always read as unknown, and writing to it would have appended a duplicate CV_FDR_ flag rather than replacing the existing one (#26, #27; also closes #32). - common: add energy_saved_kwh (x.com.samsung.da.cumulativeSavedPower) and power_energy_kwh (x.com.samsung.da.cumulativeConsumption) to the shared energy meter, plus fridge-only energy_last_month_kwh/energy_this_month_kwh (monthlyConsumption/thismonthlyConsumption) -- all self-gating on field presence (#26). - by_type: add the WV consumer-model prefix (FlexWash twin washers, e.g. WV55M9600AW) to the by-model fallback map. These report no oneUiVersion and previously matched no prefix at all, so they fell all the way through to the unrecognized-device registry with zero capabilities bound (#19). - washer: add a self-gating dry_level select to WASHER_SETTINGS for washer/dryer combo units, which carry a writable dryLevel field directly on /washer/vs/0 with no separate dryer resource or course (#22). The reset-water-filter button and "ice type vs. two named icemakers" requests from #26/#27 are left alone -- no write contract or exclusivity behavior is evidenced in either dump, and both icemakers report On simultaneously on the Bespoke unit, so synthesizing a single-select would be a guess rather than a fix. Adds scrubbed fixtures + goldens for FlexWash, a washer/dryer combo, ARTIK051_REF_17K, and TP2X_REF_20K, plus unit tests for the new/changed capabilities.
This commit is contained in:
22 files changed
+1719
-11
No files matched your search
@@ -40,6 +40,22 @@ class TestWasherSettings:
|
||||
assert body == {'x.com.samsung.da.rinseCycles': '3'}
|
||||
|
||||
|
||||
class TestDryLevel:
|
||||
"""Washer/dryer combo units carry a writable dryLevel field on
|
||||
/washer/vs/0 itself, self-gated off on plain washers -- issue #22."""
|
||||
|
||||
def test_exists_only_when_supported_dry_level_present(self):
|
||||
desc = next(e for e in washer.WASHER_SETTINGS.entities if e.key == 'dry_level')
|
||||
assert desc.exists_fn({'x.com.samsung.da.supportedDryLevel': ['None', '30']}, {}) is True
|
||||
assert desc.exists_fn({}, {}) is False
|
||||
|
||||
def test_write(self):
|
||||
desc = next(e for e in washer.WASHER_SETTINGS.entities if e.key == 'dry_level')
|
||||
path, body = desc.write_fn('Cupboard', {})
|
||||
assert path == ['washer', 'vs', '0']
|
||||
assert body == {'x.com.samsung.da.dryLevel': 'Cupboard'}
|
||||
|
||||
|
||||
class TestWasherCourse:
|
||||
def test_href(self):
|
||||
assert washer.WASHER_COURSE.href == '/course/vs/0'
|
||||
@@ -233,3 +249,45 @@ class TestDetergentSoftenerDosing:
|
||||
assert self._desc('detergent_low').exists_fn({'x.com.samsung.da.options': []}, {}) is False
|
||||
rep = {'x.com.samsung.da.options': _DOSING_OPTIONS}
|
||||
assert self._desc('detergent_low').exists_fn(rep, {}) is True
|
||||
|
||||
|
||||
class TestFlexWashAndComboFixturesHaveCompleteCoverage:
|
||||
"""FlexWash (issue #19, previously unrecognized entirely) and
|
||||
washer/dryer combo (issue #22, dry_level) dumps must both resolve to
|
||||
zero unbound hrefs."""
|
||||
|
||||
def test_flexwash(self):
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import washer as washer_registry
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from tests.conftest import _load_device
|
||||
|
||||
resources = _load_device('washer_flexwash')
|
||||
unbound = []
|
||||
bound = discover(
|
||||
resources,
|
||||
washer_registry.REGISTRY.capabilities,
|
||||
washer_registry.REGISTRY.pattern_capabilities,
|
||||
log=unbound.append,
|
||||
)
|
||||
assert unbound == []
|
||||
flatten(bound, resources) # doesn't raise
|
||||
|
||||
def test_dryer_combo(self):
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import washer as washer_registry
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from tests.conftest import _load_device
|
||||
|
||||
resources = _load_device('washer_dryer_combo')
|
||||
unbound = []
|
||||
bound = discover(
|
||||
resources,
|
||||
washer_registry.REGISTRY.capabilities,
|
||||
washer_registry.REGISTRY.pattern_capabilities,
|
||||
log=unbound.append,
|
||||
)
|
||||
assert unbound == []
|
||||
state = flatten(bound, resources)
|
||||
# the device's own "off" sentinel is the literal string 'None', not absence
|
||||
assert state['dry_level'] == 'None'
|
||||
Reference in new issue
Block a user