Merge pull request #281 from atc722/agent/nv9000d-regression-fix
Fix read-only sensor categories and add NV9000D coverage
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -957,7 +957,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,
|
||||
),
|
||||
@@ -965,7 +965,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,
|
||||
),
|
||||
|
||||
@@ -178,7 +178,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",
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user