Add NV9000D cooktop coverage and fix sensor setup

This commit is contained in:
hoon committed 2026-08-04 14:47:42 +09:00
1 parent 0c2e219464
commit 3d0dca20f9
9 files changed
+353 -8

No files matched your search

@@ -18,12 +18,17 @@ def is_stub_rep(rep: dict) -> bool:
def parse_device0_batch(device0: list) -> dict[str, dict]:
"""Extract {href: rep} from a /device/0 CBOR list response.
Most devices put a collection representation without an ``href`` at
index 0, while some firmware starts directly with resource entries.
Iterate the whole list and let the existing href check ignore collection
metadata so the first real resource is preserved in either shape.
A stub rep is passed through unchanged rather than collapsed to {} --
downstream code (entity._is_included, capability exists_fns) uses
is_stub_rep to tell "not fetched yet" apart from a confirmed-empty {}.
"""
out = {}
for entry in device0[1:]: # skip [0] (device-level rep)
for entry in device0:
if not isinstance(entry, dict):
continue
href = entry.get("href")
@@ -1078,7 +1078,7 @@ REFRIGERATION_FALLBACK = Capability(
key="rapid_fridge",
field="rapidCool",
icon="mdi:fridge-industrial",
entity_category="config",
entity_category="diagnostic",
value_fn=lambda v: bool(v),
exists_fn=lambda rep, resources: "/refrigeration/vs/0" not in resources,
),
@@ -1086,7 +1086,7 @@ REFRIGERATION_FALLBACK = Capability(
key="rapid_freezing",
field="rapidFreeze",
icon="mdi:snowflake",
entity_category="config",
entity_category="diagnostic",
value_fn=lambda v: bool(v),
exists_fn=lambda rep, resources: "/refrigeration/vs/0" not in resources,
),
@@ -186,7 +186,7 @@ COOKTOP_SAFETY = Capability(
BinarySensorDesc(
key="cooktop_safety_shutoff_enabled",
field="safetyAlert",
entity_category="config",
entity_category="diagnostic",
value_fn=lambda v: (v or {}).get("state") == "on",
),
),