Add standalone induction-cooktop support (issue #86)

TP1X_DA-KS-COOKTOP-01011 (NV8500T-/KO4) is the same board family and
/cooktop/status/vs/0 resource shape as issue #44's range combo, minus
the oven -- but its modelNum uses the hyphenated '-COOKTOP-' token,
which for_device_by_model's existing '_COOKTOP' check (underscore-
delimited, matching the unrelated NA9300K gas-cooktop family in
cooktop.py) doesn't match. The device fell back to 'unknown' with only
energy/alarms from the global fallback.

Add the hyphenated token check, routing to a new 'induction_cooktop'
registry (by_type/induction_cooktop.py) that reuses range.py's
COOKTOP_STATUS/COOKTOP_SPEC/COOKTOP_SAFETY/PROBE_STATUS and
cooktop.PAIRED_HOOD_STATUS wholesale rather than pulling in range.py's
oven capabilities, which this device has no hrefs for at all.

Along the way, three fields the reporter asked for turned out to be
gaps in the shared range.py capability itself, not just missing
routing -- also present (and previously unmodeled) on issue #44's
original combo-range dump:
- /cooktop/status/vs/0's own `power` and `childLock` fields (distinct
  from common.POWER's /power/0 or /power/vs/0, which a combo range
  additionally carries for the whole appliance) -- childLock gets a
  write_fn (a safe lock toggle, direct single-field PUT), power stays
  read-only (no live device to confirm a remote write wouldn't leave a
  burner active unattended).
- Each burner's `panDetection` field.

New: a Bluetooth meat-probe capability for /bluetooth/probe/status/vs/0
(read-only -- connection, battery, current/target temperature), and
/cooktop/recipe/status/vs/0 is ignored (every field empty on this idle
dump, same treatment as the microwave family's /recipe/cook/vs/0).

Regenerates the range golden fixture (gains cooktop_power/
cooktop_child_lock/burner_N_pan_detected) and adds a dedicated fixture
for the standalone cooktop.
This commit is contained in:
Marc Billow committed 2026-07-27 01:12:16 +00:00
1 parent aff7647460
commit a453dc9ece
13 files changed
+574 -2

No files matched your search

+38
View File
@@ -82,3 +82,41 @@ def test_burner_hot_surface_true_when_not_normal():
if e.key == 'burner_0_hot_surface')
assert desc.value_fn([{'burnerNumber': 0, 'hotSurfaceState': 'hot'}]) is True
assert desc.value_fn([{'burnerNumber': 0, 'hotSurfaceState': 'normal'}]) is False
def test_burner_pan_detected(): # issue #86
desc = next(e for e in range_caps.COOKTOP_STATUS.entities
if e.key == 'burner_0_pan_detected')
assert desc.value_fn([{'burnerNumber': 0, 'panDetection': True}]) is True
assert desc.value_fn([{'burnerNumber': 0, 'panDetection': False}]) is False
assert desc.value_fn([{'burnerNumber': 1, 'panDetection': True}]) is False # different burner
def test_cooktop_power_is_read_only(): # issue #86
desc = next(e for e in range_caps.COOKTOP_STATUS.entities if e.key == 'cooktop_power')
assert desc.value_fn('On') is True
assert desc.value_fn('Off') is False
assert not hasattr(desc, 'write_fn') # BinarySensorDesc has no write path at all
def test_cooktop_child_lock_write(): # issue #86
desc = next(e for e in range_caps.COOKTOP_STATUS.entities if e.key == 'cooktop_child_lock')
assert desc.value_fn('on') is True
assert desc.value_fn('off') is False
path, body = desc.write_fn('On', {})
assert path == ['cooktop', 'status', 'vs', '0']
assert body == {'childLock': 'on'}
assert desc.write_fn('Bogus', {}) is None
def test_probe_status_temperature_unit_reads_live_field(): # issue #86
desc = next(e for e in range_caps.PROBE_STATUS.entities if e.key == 'probe_temperature')
assert desc.unit_fn({'temperatureUnit': 'C'}) == '°C'
assert desc.unit_fn({'temperatureUnit': 'F'}) == '°F'
assert desc.unit_fn({}) == '°C'
def test_probe_status_connected_value_fn(): # issue #86
desc = next(e for e in range_caps.PROBE_STATUS.entities if e.key == 'probe_connected')
assert desc.value_fn('Connected') is True
assert desc.value_fn('Disconnected') is False