Add device support for Samsung Refrigerator TP1X_REF_21K auto-door variants (issue #328)

Three new dumps from one household's TP1X_REF_21K fleet (regular
single-door, kimchi, wine cellar) exposed the Auto Door Open feature's
timer and voice/sound feedback toggles, plus wine-cellar-specific
coverage: a deodorizing filter at its own href, a multi-compartment
pantry select, and a table-revision info resource.

- STATUS_LOCK gains auto_door_voice_control/auto_door_sound_control,
  gated on each field's own presence.
- New AUTO_DOOR_TIMER (a discrete-options select, same shape as the
  DEFINITE_TEMPERATURE_COOLER/FREEZER pattern) and three no-entity
  AUTO_DOOR_SINGLE/KIMCHI/WINECELLAR coverage hrefs -- every dump seen
  reports exactly one openOptions value with no paired current/desired
  field to choose against.
- New DEODOR_FILTER (reuses AIR_FILTER's entities at a different href),
  WINECELLAR_PANTRY_ZONE, and WINECELLAR_INFO.
- by_type: oic.d.krefrigerator and x.com.st.d.winecellar routed to the
  refrigerator registry via /oic/d, alongside the existing modelNum-based
  routing.
- kimchi_zone_mode's translation catalog gains three supportMode codes
  (bare storage_fridge/storage_freezer without the _normal suffix, and
  the apparently-placeholder newmode_kimchi_0000) surfaced by the kimchi
  fixture, across all seven languages.

Three new scrubbed fixtures + goldens + tests, one per variant.
This commit is contained in:
Marc Billow committed 2026-08-09 00:57:36 +00:00
1 parent 07c20e82aa
commit b6f0bc22cb
20 files changed
+1753 -7

No files matched your search

@@ -0,0 +1,78 @@
"""Wine-cellar refrigerator variant (issue #328, x.com.st.d.winecellar
device type -- RW33C99B1TFG-class, TP1X_REF_21K board). Auto Door Open's
winecellar-specific declaration href, a deodorizing filter reported at a
different href than the regular AIR_FILTER, a multi-compartment pantry
select, and a table-revision info resource -- all new coverage this dump
surfaced.
"""
from custom_components.localthings.registry.adapter import flatten
from custom_components.localthings.registry.by_type import for_device_by_oic_type, resolve
from custom_components.localthings.registry.capabilities import fridge
from custom_components.localthings.registry.discovery import discover
from tests.conftest import _load_device
FIXTURE = "refrigerator_winecellar"
DEVICE_TYPES = ("oic.wk.d", "x.com.st.d.winecellar")
def _fridge():
resources = _load_device(FIXTURE)
reg = resolve(resources, device_types=DEVICE_TYPES)
return reg, resources
def _state():
reg, resources = _fridge()
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
return flatten(bound, resources)
def test_resolves_via_oic_type():
reg = for_device_by_oic_type(DEVICE_TYPES)
assert reg is not None and reg.name == "refrigerator"
def test_no_unbound_hrefs():
reg, resources = _fridge()
unbound = []
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
assert unbound == []
def test_auto_door_sound_control_present_here_only():
"""This variant's dump is the only one that carries
ado.soundcontrol -- the other TP1X_REF_21K auto-door fixtures don't."""
state = _state()
assert state["auto_door_sound_control"] is True
assert state["auto_door_voice_control"] is False
def test_deodor_filter_reuses_air_filter_shape():
"""Same entities as fridge.AIR_FILTER (see its own already-confirmed
percentage-not-raw-count reasoning), bound at this variant's own href."""
assert fridge.DEODOR_FILTER.entities is fridge.AIR_FILTER.entities
state = _state()
assert state["air_filter_status"] == "normal"
# The device's own sentinel, relayed as-is -- not a real 0-100 reading
# on this unit, and no second dump to say what else -1 could mean.
assert state["air_filter_usage"] == -1
def test_winecellar_pantry_zone_mode_options_and_write():
desc = next(
e for e in fridge.WINECELLAR_PANTRY_ZONE.entities if e.key == "winecellar_pantry_zone_mode"
)
assert desc.options_field == "x.com.samsung.da.supportedOptions"
assert desc.write_fn is not None
assert desc.write_fn("Cheese", {}) == (
["status", "winecellar", "pantry", "one", "vs", "0"],
{"x.com.samsung.da.mode": "Cheese"},
)
state = _state()
assert state["winecellar_pantry_zone_mode"] == "Fruit"
def test_winecellar_variant_and_info_hrefs_bound_with_no_entities():
assert fridge.AUTO_DOOR_WINECELLAR.entities == ()
assert fridge.WINECELLAR_INFO.entities == ()