Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,21 @@ def zigpy_device_from_device_data(
endpoint.request = AsyncMock(return_value=[0])

for cluster_type in ("in_clusters", "out_clusters"):
clusters = getattr(endpoint, cluster_type)

for cluster in ep[cluster_type]:
real_cluster = getattr(endpoint, cluster_type)[
int(cluster["cluster_id"], 16)
]
cluster_id = int(cluster["cluster_id"], 16)

try:
real_cluster = clusters[cluster_id]
except KeyError:
_LOGGER.warning(
"Cluster %0#04x not found on endpoint %r of device %s",
cluster_id,
endpoint,
device,
)
continue

if patch_cluster:
patch_cluster_for_testing(real_cluster)
Expand Down
Loading
Loading