From f69507527b75eccc01dd2e9ba448b5533db0b1f0 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sat, 10 Aug 2024 20:55:31 +0200 Subject: [PATCH] Make sure diagnostic data is output in deterministic order ZHA (#123551) Make sure diagnostic data is output in deterministic order Sets are not ordered, so the tests for this failed sporadically since it is converted into a list when converted to json. --- homeassistant/components/zha/diagnostics.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/zha/diagnostics.py b/homeassistant/components/zha/diagnostics.py index 3e598c4d5f8..f276630dfee 100644 --- a/homeassistant/components/zha/diagnostics.py +++ b/homeassistant/components/zha/diagnostics.py @@ -166,5 +166,7 @@ def get_cluster_attr_data(cluster: Cluster) -> dict: } for attr_id, attr_def in cluster.attributes.items() }, - UNSUPPORTED_ATTRIBUTES: cluster.unsupported_attributes, + UNSUPPORTED_ATTRIBUTES: sorted( + cluster.unsupported_attributes, key=lambda v: (isinstance(v, str), v) + ), }