From aec3c5e46092eff87c46ff42532831357aeb532c Mon Sep 17 00:00:00 2001 From: Marc Billow Date: Thu, 23 Jul 2026 02:04:33 +0000 Subject: [PATCH] Rename cooktop.py capabilities module to range.py to avoid PR #23 collision PR #23 independently adds registry/capabilities/cooktop.py for an unrelated standalone-cooktop product (NA9300K-class, burner state encoded in /mode/vs/0's options array) -- different hardware and a different OCF surface than issue #44's oven+cooktop combo range, but the same file path. Rename ours to range.py to keep both mergeable. --- custom_components/localthings/registry/by_type/range.py | 9 +++++---- .../registry/capabilities/{cooktop.py => range.py} | 6 ++++++ tests/test_range_capabilities.py | 8 ++++---- 3 files changed, 15 insertions(+), 8 deletions(-) rename custom_components/localthings/registry/capabilities/{cooktop.py => range.py} (93%) diff --git a/custom_components/localthings/registry/by_type/range.py b/custom_components/localthings/registry/by_type/range.py index fe50bcf..7cc891f 100644 --- a/custom_components/localthings/registry/by_type/range.py +++ b/custom_components/localthings/registry/by_type/range.py @@ -5,7 +5,8 @@ connected capabilities wholesale (a range's oven half is the same OCF surface as a standalone oven) and adds the cooktop-specific capabilities for the burner half. """ -from ..capabilities import common, cooktop, ignored, oven +from ..capabilities import common, ignored, oven +from ..capabilities import range as range_caps from ._base import DeviceRegistry, _build REGISTRY = DeviceRegistry( @@ -21,8 +22,8 @@ REGISTRY = DeviceRegistry( oven.OVEN_DOOR, oven.OVEN_CONNECTED, oven.OVEN_SPEC, - cooktop.COOKTOP_STATUS, - cooktop.COOKTOP_SPEC, - cooktop.COOKTOP_SAFETY, + range_caps.COOKTOP_STATUS, + range_caps.COOKTOP_SPEC, + range_caps.COOKTOP_SAFETY, ]), ) diff --git a/custom_components/localthings/registry/capabilities/cooktop.py b/custom_components/localthings/registry/capabilities/range.py similarity index 93% rename from custom_components/localthings/registry/capabilities/cooktop.py rename to custom_components/localthings/registry/capabilities/range.py index a665c20..7c1e195 100644 --- a/custom_components/localthings/registry/capabilities/cooktop.py +++ b/custom_components/localthings/registry/capabilities/range.py @@ -1,6 +1,12 @@ """Capabilities for the cooktop half of range/combo appliances (issue #44, model TP1X_DA-KS-RANGE-0102X). +Not to be confused with PR #23's registry/capabilities/cooktop.py, which +covers an unrelated standalone-cooktop product (NA9300K-class) that encodes +burner state as strings inside /mode/vs/0's options array instead of the +structured /cooktop/status/vs/0 resource this module reads -- two different +OCF surfaces that happen to share the English word "cooktop". + Unlike the rest of the OCF surface, these hrefs use plain camelCase field names (no `x.com.samsung.da.` prefix) -- `/cooktop/status/vs/0` already looks like a vendor resource migrated onto OCF-standard-shaped field naming. diff --git a/tests/test_range_capabilities.py b/tests/test_range_capabilities.py index e04733a..cc5de15 100644 --- a/tests/test_range_capabilities.py +++ b/tests/test_range_capabilities.py @@ -1,7 +1,7 @@ """Tests for range/cooktop-oven combo support (issue #44).""" from custom_components.localthings.registry.adapter import flatten from custom_components.localthings.registry.by_type import for_device_by_model -from custom_components.localthings.registry.capabilities import cooktop +from custom_components.localthings.registry.capabilities import range as range_caps from custom_components.localthings.registry.discovery import discover from tests.conftest import _load_device @@ -57,7 +57,7 @@ def test_unreported_burners_gated_out(): def test_burner_power_level_write_is_read_modify_write(): - desc = next(e for e in cooktop.COOKTOP_STATUS.entities + desc = next(e for e in range_caps.COOKTOP_STATUS.entities if e.key == 'burner_1_power_level') rep = {'burnerList': [ {'burnerNumber': 0, 'powerLevel': '3'}, @@ -71,14 +71,14 @@ def test_burner_power_level_write_is_read_modify_write(): def test_burner_power_level_write_rejects_missing_burner(): - desc = next(e for e in cooktop.COOKTOP_STATUS.entities + desc = next(e for e in range_caps.COOKTOP_STATUS.entities if e.key == 'burner_2_power_level') rep = {'burnerList': [{'burnerNumber': 0, 'powerLevel': '0'}]} assert desc.write_fn('5', rep) is None def test_burner_hot_surface_true_when_not_normal(): - desc = next(e for e in cooktop.COOKTOP_STATUS.entities + desc = next(e for e in range_caps.COOKTOP_STATUS.entities 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