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.
This commit is contained in:
3 files changed
+15
-8
No files matched your search
@@ -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
|
surface as a standalone oven) and adds the cooktop-specific capabilities
|
||||||
for the burner half.
|
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
|
from ._base import DeviceRegistry, _build
|
||||||
|
|
||||||
REGISTRY = DeviceRegistry(
|
REGISTRY = DeviceRegistry(
|
||||||
@@ -21,8 +22,8 @@ REGISTRY = DeviceRegistry(
|
|||||||
oven.OVEN_DOOR,
|
oven.OVEN_DOOR,
|
||||||
oven.OVEN_CONNECTED,
|
oven.OVEN_CONNECTED,
|
||||||
oven.OVEN_SPEC,
|
oven.OVEN_SPEC,
|
||||||
cooktop.COOKTOP_STATUS,
|
range_caps.COOKTOP_STATUS,
|
||||||
cooktop.COOKTOP_SPEC,
|
range_caps.COOKTOP_SPEC,
|
||||||
cooktop.COOKTOP_SAFETY,
|
range_caps.COOKTOP_SAFETY,
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
+6
@@ -1,6 +1,12 @@
|
|||||||
"""Capabilities for the cooktop half of range/combo appliances (issue #44,
|
"""Capabilities for the cooktop half of range/combo appliances (issue #44,
|
||||||
model TP1X_DA-KS-RANGE-0102X).
|
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
|
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
|
names (no `x.com.samsung.da.` prefix) -- `/cooktop/status/vs/0` already
|
||||||
looks like a vendor resource migrated onto OCF-standard-shaped field naming.
|
looks like a vendor resource migrated onto OCF-standard-shaped field naming.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
"""Tests for range/cooktop-oven combo support (issue #44)."""
|
"""Tests for range/cooktop-oven combo support (issue #44)."""
|
||||||
from custom_components.localthings.registry.adapter import flatten
|
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.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 custom_components.localthings.registry.discovery import discover
|
||||||
|
|
||||||
from tests.conftest import _load_device
|
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():
|
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')
|
if e.key == 'burner_1_power_level')
|
||||||
rep = {'burnerList': [
|
rep = {'burnerList': [
|
||||||
{'burnerNumber': 0, 'powerLevel': '3'},
|
{'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():
|
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')
|
if e.key == 'burner_2_power_level')
|
||||||
rep = {'burnerList': [{'burnerNumber': 0, 'powerLevel': '0'}]}
|
rep = {'burnerList': [{'burnerNumber': 0, 'powerLevel': '0'}]}
|
||||||
assert desc.write_fn('5', rep) is None
|
assert desc.write_fn('5', rep) is None
|
||||||
|
|
||||||
|
|
||||||
def test_burner_hot_surface_true_when_not_normal():
|
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')
|
if e.key == 'burner_0_hot_surface')
|
||||||
assert desc.value_fn([{'burnerNumber': 0, 'hotSurfaceState': 'hot'}]) is True
|
assert desc.value_fn([{'burnerNumber': 0, 'hotSurfaceState': 'hot'}]) is True
|
||||||
assert desc.value_fn([{'burnerNumber': 0, 'hotSurfaceState': 'normal'}]) is False
|
assert desc.value_fn([{'burnerNumber': 0, 'hotSurfaceState': 'normal'}]) is False
|
||||||
Reference in new issue
Block a user