Rename gas cooktop registry's display name to avoid induction_cooktop confusion
Renames DeviceRegistry.name from 'cooktop' to 'gas_cooktop' for the NA9300K-class gas-cooktop registry (PR #23), so diagnostics/device-info labels no longer collide with the unrelated induction_cooktop family (issue #86) -- two different OCF surfaces that happen to share the English word "cooktop". Safe rename: _REGISTRY_BY_KEY's 'cooktop' lookup key is unchanged, so all three existing detection paths (oneUiVersion "Cooktop" exact match, the legacy ARTIK051 modelNum rule, and the resource-signature fallback) keep routing real devices exactly as before. Entity unique_ids are built from device serial + entity key, not registry name, so existing entities are unaffected. Only the DeviceInfo.name and diagnostics device_type strings change, both cosmetic.
This commit is contained in:
4 files changed
+20
-7
No files matched your search
@@ -25,7 +25,7 @@ Your state stays on your LAN: HA talks to the appliance over a direct DTLS sessi
|
|||||||
| Air purifier | `by_type/air_purifier.py` |
|
| Air purifier | `by_type/air_purifier.py` |
|
||||||
| Dryer | `by_type/dryer.py` |
|
| Dryer | `by_type/dryer.py` |
|
||||||
| Oven | `by_type/oven.py` |
|
| Oven | `by_type/oven.py` |
|
||||||
| Cooktop (read-only burner status) | `by_type/cooktop.py` |
|
| Gas cooktop (read-only burner status) | `by_type/cooktop.py` |
|
||||||
| Range hood | `by_type/range_hood.py` |
|
| Range hood | `by_type/range_hood.py` |
|
||||||
| Range | `by_type/range.py` |
|
| Range | `by_type/range.py` |
|
||||||
| Dishwasher | `by_type/dishwasher.py` |
|
| Dishwasher | `by_type/dishwasher.py` |
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
"""Cooktop device registry."""
|
"""Gas cooktop device registry (NA9300K-class, PR #23).
|
||||||
|
|
||||||
|
Named 'gas_cooktop' (not 'cooktop') so its diagnostics/device-info label
|
||||||
|
doesn't collide with the unrelated induction_cooktop family (issue #86,
|
||||||
|
by_type/induction_cooktop.py) -- two different OCF surfaces that happen to
|
||||||
|
share the English word "cooktop". The `_REGISTRY_BY_KEY['cooktop']` lookup
|
||||||
|
key is unchanged: it's relied on by real devices reporting
|
||||||
|
oneUiVersion "Cooktop" (for_device), the legacy ARTIK051 modelNum rule
|
||||||
|
(for_device_by_model), and the resource-signature fallback
|
||||||
|
(for_device_by_resources) alike.
|
||||||
|
"""
|
||||||
|
|
||||||
from ..capabilities import common, cooktop, ignored
|
from ..capabilities import common, cooktop, ignored
|
||||||
from ._base import DeviceRegistry, _build
|
from ._base import DeviceRegistry, _build
|
||||||
|
|
||||||
|
|
||||||
REGISTRY = DeviceRegistry(
|
REGISTRY = DeviceRegistry(
|
||||||
name='cooktop',
|
name='gas_cooktop',
|
||||||
capabilities=_build([
|
capabilities=_build([
|
||||||
*ignored.IGNORED,
|
*ignored.IGNORED,
|
||||||
cooktop.COOKTOP_POWER,
|
cooktop.COOKTOP_POWER,
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ def test_run_discovery_detects_cooktop_via_resource_signature(
|
|||||||
coordinator = LocalThingsCoordinator(hass, mock_entry)
|
coordinator = LocalThingsCoordinator(hass, mock_entry)
|
||||||
coordinator._run_discovery(_load_device('cooktop'))
|
coordinator._run_discovery(_load_device('cooktop'))
|
||||||
|
|
||||||
assert coordinator.device_type_name == 'cooktop'
|
assert coordinator.device_type_name == 'gas_cooktop'
|
||||||
assert coordinator._unbound_hrefs == []
|
assert coordinator._unbound_hrefs == []
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,9 +42,12 @@ class TestForDevice:
|
|||||||
assert registry.name == 'refrigerator'
|
assert registry.name == 'refrigerator'
|
||||||
|
|
||||||
def test_for_device_returns_cooktop_registry(self):
|
def test_for_device_returns_cooktop_registry(self):
|
||||||
|
"""The registry's own .name is 'gas_cooktop' (disambiguated from
|
||||||
|
induction_cooktop), but the lookup key devices route through stays
|
||||||
|
'cooktop' -- oneUiVersion "Cooktop" still resolves here."""
|
||||||
registry = for_device('7.0 Cooktop')
|
registry = for_device('7.0 Cooktop')
|
||||||
assert registry is not None
|
assert registry is not None
|
||||||
assert registry.name == 'cooktop'
|
assert registry.name == 'gas_cooktop'
|
||||||
|
|
||||||
def test_for_device_returns_range_hood_registry(self):
|
def test_for_device_returns_range_hood_registry(self):
|
||||||
registry = for_device('7.0 Range Hood')
|
registry = for_device('7.0 Range Hood')
|
||||||
@@ -258,7 +261,7 @@ class TestForDeviceByModel:
|
|||||||
'ARTIK051_GLOBAL_COOKTOP',
|
'ARTIK051_GLOBAL_COOKTOP',
|
||||||
)
|
)
|
||||||
assert reg is not None
|
assert reg is not None
|
||||||
assert reg.name == 'cooktop'
|
assert reg.name == 'gas_cooktop'
|
||||||
|
|
||||||
def test_range_hood_via_ahd_model(self):
|
def test_range_hood_via_ahd_model(self):
|
||||||
from custom_components.localthings.registry.by_type import for_device_by_model
|
from custom_components.localthings.registry.by_type import for_device_by_model
|
||||||
@@ -319,7 +322,7 @@ class TestForDeviceByResources:
|
|||||||
reg = for_device_by_resources(_load_device('cooktop'))
|
reg = for_device_by_resources(_load_device('cooktop'))
|
||||||
|
|
||||||
assert reg is not None
|
assert reg is not None
|
||||||
assert reg.name == 'cooktop'
|
assert reg.name == 'gas_cooktop'
|
||||||
|
|
||||||
def test_unrelated_mode_options_are_not_cooktop(self):
|
def test_unrelated_mode_options_are_not_cooktop(self):
|
||||||
from custom_components.localthings.registry.by_type import for_device_by_resources
|
from custom_components.localthings.registry.by_type import for_device_by_resources
|
||||||
|
|||||||
Reference in new issue
Block a user