Merge pull request #230 from moKorean/oic-type-hood
Add x.com.st.d.hood to _OIC_TYPE_TO_KEY; document why oic.d.cooktop is not mapped
This commit is contained in:
2 files changed
+24
No files matched your search
@@ -214,6 +214,16 @@ def _consumer_model_key(description: str) -> Optional[str]:
|
|||||||
# device-type vocabulary (used for categories with no `oic.d.*` equivalent),
|
# device-type vocabulary (used for categories with no `oic.d.*` equivalent),
|
||||||
# same prefix convention as the `x.com.samsung.da.*` resource fields
|
# same prefix convention as the `x.com.samsung.da.*` resource fields
|
||||||
# elsewhere in this codebase.
|
# elsewhere in this codebase.
|
||||||
|
#
|
||||||
|
# `oic.d.cooktop` is deliberately absent, and is the one measured type left out.
|
||||||
|
# A TP1X_DA-KS-COOKTOP induction reports it, but `cooktop` and
|
||||||
|
# `induction_cooktop` are two unrelated registries that happen to share the
|
||||||
|
# English word (see by_type/cooktop.py's docstring: the NA9300K gas family keeps
|
||||||
|
# burner state in /mode/vs/0's options array, a completely different OCF
|
||||||
|
# surface). The OCF type does not distinguish them, so mapping it to either key
|
||||||
|
# would silently misroute the other -- and as the *primary* signal it would
|
||||||
|
# override a `COOKTOP`/`CT` board token that had it right. Same reasoning as
|
||||||
|
# `oic.d.robotcleaner` above: no unambiguous key to point at, so no row.
|
||||||
_OIC_TYPE_TO_KEY: dict[str, str] = {
|
_OIC_TYPE_TO_KEY: dict[str, str] = {
|
||||||
'oic.d.airconditioner': 'airconditioner',
|
'oic.d.airconditioner': 'airconditioner',
|
||||||
'oic.d.airpurifier': 'air_purifier',
|
'oic.d.airpurifier': 'air_purifier',
|
||||||
@@ -223,6 +233,7 @@ _OIC_TYPE_TO_KEY: dict[str, str] = {
|
|||||||
'oic.d.refrigerator': 'refrigerator',
|
'oic.d.refrigerator': 'refrigerator',
|
||||||
'oic.d.washer': 'washer',
|
'oic.d.washer': 'washer',
|
||||||
'x.com.st.d.airqualitysensor': 'air_monitor',
|
'x.com.st.d.airqualitysensor': 'air_monitor',
|
||||||
|
'x.com.st.d.hood': 'range_hood', # AHD-WW-TP1-22-COMMON
|
||||||
'x.com.st.d.stickcleaner': 'vacuum_station',
|
'x.com.st.d.stickcleaner': 'vacuum_station',
|
||||||
'x.com.st.d.steamcloset': 'air_dresser',
|
'x.com.st.d.steamcloset': 'air_dresser',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ class TestForDeviceByOicType:
|
|||||||
('oic.d.oven', 'oven'),
|
('oic.d.oven', 'oven'),
|
||||||
('oic.d.refrigerator', 'refrigerator'),
|
('oic.d.refrigerator', 'refrigerator'),
|
||||||
('oic.d.washer', 'washer'),
|
('oic.d.washer', 'washer'),
|
||||||
|
('x.com.st.d.hood', 'range_hood'),
|
||||||
('x.com.st.d.stickcleaner', 'vacuum_station'),
|
('x.com.st.d.stickcleaner', 'vacuum_station'),
|
||||||
('x.com.st.d.steamcloset', 'air_dresser'),
|
('x.com.st.d.steamcloset', 'air_dresser'),
|
||||||
('x.com.st.d.airqualitysensor', 'air_monitor'),
|
('x.com.st.d.airqualitysensor', 'air_monitor'),
|
||||||
@@ -177,6 +178,18 @@ class TestForDeviceByOicType:
|
|||||||
from custom_components.localthings.registry.by_type import for_device_by_oic_type
|
from custom_components.localthings.registry.by_type import for_device_by_oic_type
|
||||||
assert for_device_by_oic_type(('oic.d.robotcleaner',)) is None
|
assert for_device_by_oic_type(('oic.d.robotcleaner',)) is None
|
||||||
|
|
||||||
|
def test_cooktop_is_not_mapped_to_either_cooktop_registry(self):
|
||||||
|
"""'oic.d.cooktop' cannot tell the two cooktop families apart.
|
||||||
|
|
||||||
|
A TP1X_DA-KS-COOKTOP induction reports it, but `cooktop` is the
|
||||||
|
unrelated NA9300K gas family (burner state in /mode/vs/0's options
|
||||||
|
array, a different OCF surface -- see by_type/cooktop.py). Mapping the
|
||||||
|
type to either key would misroute the other, and as the primary signal
|
||||||
|
it would override a board token that had it right.
|
||||||
|
"""
|
||||||
|
from custom_components.localthings.registry.by_type import for_device_by_oic_type
|
||||||
|
assert for_device_by_oic_type(('oic.d.cooktop',)) is None
|
||||||
|
|
||||||
def test_empty_returns_none(self):
|
def test_empty_returns_none(self):
|
||||||
from custom_components.localthings.registry.by_type import for_device_by_oic_type
|
from custom_components.localthings.registry.by_type import for_device_by_oic_type
|
||||||
assert for_device_by_oic_type(()) is None
|
assert for_device_by_oic_type(()) is None
|
||||||
|
|||||||
Reference in new issue
Block a user