Skip to content

Commit 54975cb

Browse files
authored
Diagnostics import for October (#557)
* Import diagnostics data * Regenerate diagnostics Regenerate diagnostics * Allow for deleted clusters when importing diagnostics * Move metering formatting out of cluster handler and into entity * Revert "Move metering formatting out of cluster handler and into entity" This reverts commit 70c7843. * Delete failing device diagnostic JSON * Allow for missing endpoints in diagnostics * Regenerate diagnostics
1 parent 21e1e7f commit 54975cb

File tree

220 files changed

+135850
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+135850
-4
lines changed

tests/common.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,34 @@ def zigpy_device_from_device_data(
381381
device = quirks_get_device(device)
382382

383383
for epid, ep in device_data["endpoints"].items():
384-
endpoint = device.endpoints[int(epid)]
384+
try:
385+
endpoint = device.endpoints[int(epid)]
386+
except KeyError:
387+
_LOGGER.warning(
388+
"Endpoint %d not found on device %s",
389+
int(epid),
390+
device,
391+
)
392+
continue
393+
385394
endpoint.request = AsyncMock(return_value=[0])
386395

387396
for cluster_type in ("in_clusters", "out_clusters"):
397+
clusters = getattr(endpoint, cluster_type)
398+
388399
for cluster in ep[cluster_type]:
389-
real_cluster = getattr(endpoint, cluster_type)[
390-
int(cluster["cluster_id"], 16)
391-
]
400+
cluster_id = int(cluster["cluster_id"], 16)
401+
402+
try:
403+
real_cluster = clusters[cluster_id]
404+
except KeyError:
405+
_LOGGER.warning(
406+
"Cluster %0#04x not found on endpoint %r of device %s",
407+
cluster_id,
408+
endpoint,
409+
device,
410+
)
411+
continue
392412

393413
if patch_cluster:
394414
patch_cluster_for_testing(real_cluster)

0 commit comments

Comments
 (0)