feat(fridge): expose discrete cooler temperature setpoint (#186)

RT42DG6630B1FZ is a single-door "cooler only" fridge that reports its
setpoint on /temperature/definite/cooler/vs/0 -- a vendor resource outside
both TEMP_CURRENT_GENERIC's '/temperature/current/' and TEMP_SETPOINT's
'/temperature/desired/' href prefixes, so it was entirely unbound and the
setting stayed app-only. Its supportedList (1/2/3/4/7 °C) isn't a
contiguous range, so this is modeled as a select over the device's own
live options rather than a NumberDesc that would let a user pick an
unsupported value like 5 or 6.
This commit is contained in:
Marc Billow committed 2026-07-29 13:11:07 +00:00
1 parent 74f34b91a5
commit b5c5c056f4
8 files changed
+540

No files matched your search

+38
View File
@@ -230,6 +230,44 @@ class TestPantryZone:
assert body == {'x.com.samsung.da.mode': 'FDR_WINE'}
class TestDefiniteTemperatureCooler:
"""Discrete cooler setpoint (RT42DG6630B1FZ, issue #186) -- a single-door
fridge whose /temperature/definite/cooler/vs/0 falls outside both
TEMP_CURRENT_GENERIC and TEMP_SETPOINT's href prefixes, so temperature
control was entirely unbound before this capability was added."""
def test_href(self):
assert fridge.DEFINITE_TEMPERATURE_COOLER.href == '/temperature/definite/cooler/vs/0'
def test_write(self):
desc = fridge.DEFINITE_TEMPERATURE_COOLER.entities[0]
path, body = desc.write_fn('3', {})
assert path == ['temperature', 'definite', 'cooler', 'vs', '0']
assert body == {'x.com.samsung.da.definite.desired': '3'}
def test_no_unbound_hrefs_and_discrete_options(self):
from custom_components.localthings.registry.adapter import flatten
from custom_components.localthings.registry.by_type import refrigerator
from custom_components.localthings.registry.discovery import discover
from tests.conftest import _load_device
resources = _load_device('refrigerator_definite_cooler')
unbound = []
bound = discover(
resources,
refrigerator.REGISTRY.capabilities,
refrigerator.REGISTRY.pattern_capabilities,
log=unbound.append,
)
assert unbound == []
state = flatten(bound, resources)
assert state['cooler_temperature_setpoint'] == '2'
rep = resources['/temperature/definite/cooler/vs/0']
assert rep['x.com.samsung.da.definite.supportedList'] == ['1', '2', '3', '4', '7']
class TestKimchiZone:
"""Kimchi-refrigerator compartments (TP2X_REF_20K-class, issue #26) --
top/middle/bottom each report an identically-shaped currentMode/