From 6ea5bb41df765a3af4de107aafe1866c181e300e Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Sun, 25 May 2025 21:21:35 +0200 Subject: [PATCH 1/2] Fix device diagnostics not regenerating with changed quirks --- tests/common.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/common.py b/tests/common.py index eeec1acab..c24cb2435 100644 --- a/tests/common.py +++ b/tests/common.py @@ -387,9 +387,18 @@ def zigpy_device_from_device_data( for cluster_type in ("in_clusters", "out_clusters"): for cluster in ep[cluster_type]: - real_cluster = getattr(endpoint, cluster_type)[ + real_cluster = getattr(endpoint, cluster_type).get( int(cluster["cluster_id"], 16) - ] + ) + + if real_cluster is None: + _LOGGER.warning( + "Cluster %s not found in endpoint %s of device %s", + cluster["cluster_id"], + epid, + device.ieee, + ) + continue if patch_cluster: patch_cluster_for_testing(real_cluster) From 0431943c9c0b12ef9a564cffcd811628f0e525b0 Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Sun, 25 May 2025 21:21:52 +0200 Subject: [PATCH 2/2] Add WIP/TODO --- tools/import_legacy_diagnostics.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/import_legacy_diagnostics.py b/tools/import_legacy_diagnostics.py index 7c7b14fdc..5ea774e0c 100644 --- a/tools/import_legacy_diagnostics.py +++ b/tools/import_legacy_diagnostics.py @@ -105,6 +105,7 @@ def zigpy_device_from_legacy_diagnostics( for epid, ep in cluster_data.items(): endpoint.request = AsyncMock(return_value=[0]) for cluster_id, cluster in ep["in_clusters"].items(): + # todo: likely also add here? real_cluster = device.endpoints[int(epid)].in_clusters[int(cluster_id, 16)] if patch_cluster: patch_cluster_for_testing(real_cluster)