From e090ddd7617daf64242aaaabf12998fb78d34630 Mon Sep 17 00:00:00 2001 From: Artur Pragacz <49985303+arturpragacz@users.noreply.github.com> Date: Thu, 2 Oct 2025 16:36:38 +0200 Subject: [PATCH] Move entities to the end of devices in analytics payload (#153449) --- .../components/analytics/analytics.py | 2 +- tests/components/analytics/test_analytics.py | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/analytics/analytics.py b/homeassistant/components/analytics/analytics.py index 6a2943ccd897..e788fdf9714d 100644 --- a/homeassistant/components/analytics/analytics.py +++ b/homeassistant/components/analytics/analytics.py @@ -629,7 +629,6 @@ async def async_devices_payload(hass: HomeAssistant) -> dict: # noqa: C901 devices_info.append( { - "entities": [], "entry_type": device_entry.entry_type, "has_configuration_url": device_entry.configuration_url is not None, "hw_version": device_entry.hw_version, @@ -638,6 +637,7 @@ async def async_devices_payload(hass: HomeAssistant) -> dict: # noqa: C901 "model_id": device_entry.model_id, "sw_version": device_entry.sw_version, "via_device": device_entry.via_device_id, + "entities": [], } ) diff --git a/tests/components/analytics/test_analytics.py b/tests/components/analytics/test_analytics.py index feffc952a49d..ec35cc56d51a 100644 --- a/tests/components/analytics/test_analytics.py +++ b/tests/components/analytics/test_analytics.py @@ -1075,7 +1075,6 @@ async def test_devices_payload_no_entities( "hue": { "devices": [ { - "entities": [], "entry_type": None, "has_configuration_url": True, "hw_version": "test-hw-version", @@ -1084,9 +1083,9 @@ async def test_devices_payload_no_entities( "model_id": "test-model-id", "sw_version": "test-sw-version", "via_device": None, + "entities": [], }, { - "entities": [], "entry_type": None, "has_configuration_url": False, "hw_version": None, @@ -1095,9 +1094,9 @@ async def test_devices_payload_no_entities( "model_id": None, "sw_version": None, "via_device": None, + "entities": [], }, { - "entities": [], "entry_type": None, "has_configuration_url": False, "hw_version": None, @@ -1106,9 +1105,9 @@ async def test_devices_payload_no_entities( "model_id": "test-model-id", "sw_version": None, "via_device": None, + "entities": [], }, { - "entities": [], "entry_type": None, "has_configuration_url": False, "hw_version": None, @@ -1117,6 +1116,7 @@ async def test_devices_payload_no_entities( "model_id": "test-model-id6", "sw_version": None, "via_device": ["hue", 0], + "entities": [], }, ], "entities": [], @@ -1233,6 +1233,14 @@ async def test_devices_payload_with_entities( "hue": { "devices": [ { + "entry_type": None, + "has_configuration_url": False, + "hw_version": None, + "manufacturer": "test-manufacturer", + "model": None, + "model_id": "test-model-id", + "sw_version": None, + "via_device": None, "entities": [ { "assumed_state": None, @@ -1259,6 +1267,8 @@ async def test_devices_payload_with_entities( "unit_of_measurement": None, }, ], + }, + { "entry_type": None, "has_configuration_url": False, "hw_version": None, @@ -1267,8 +1277,6 @@ async def test_devices_payload_with_entities( "model_id": "test-model-id", "sw_version": None, "via_device": None, - }, - { "entities": [ { "assumed_state": None, @@ -1279,14 +1287,6 @@ async def test_devices_payload_with_entities( "unit_of_measurement": None, }, ], - "entry_type": None, - "has_configuration_url": False, - "hw_version": None, - "manufacturer": "test-manufacturer", - "model": None, - "model_id": "test-model-id", - "sw_version": None, - "via_device": None, }, ], "entities": [ @@ -1402,7 +1402,6 @@ async def test_analytics_platforms( "test": { "devices": [ { - "entities": [], "entry_type": None, "has_configuration_url": False, "hw_version": None, @@ -1411,6 +1410,7 @@ async def test_analytics_platforms( "model_id": "test-model-id", "sw_version": None, "via_device": None, + "entities": [], }, ], "entities": [