Skip to content

Commit e090ddd

Browse files
authored
Move entities to the end of devices in analytics payload (home-assistant#153449)
1 parent 9721ce6 commit e090ddd

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

homeassistant/components/analytics/analytics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,6 @@ async def async_devices_payload(hass: HomeAssistant) -> dict: # noqa: C901
629629

630630
devices_info.append(
631631
{
632-
"entities": [],
633632
"entry_type": device_entry.entry_type,
634633
"has_configuration_url": device_entry.configuration_url is not None,
635634
"hw_version": device_entry.hw_version,
@@ -638,6 +637,7 @@ async def async_devices_payload(hass: HomeAssistant) -> dict: # noqa: C901
638637
"model_id": device_entry.model_id,
639638
"sw_version": device_entry.sw_version,
640639
"via_device": device_entry.via_device_id,
640+
"entities": [],
641641
}
642642
)
643643

tests/components/analytics/test_analytics.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,6 @@ async def test_devices_payload_no_entities(
10751075
"hue": {
10761076
"devices": [
10771077
{
1078-
"entities": [],
10791078
"entry_type": None,
10801079
"has_configuration_url": True,
10811080
"hw_version": "test-hw-version",
@@ -1084,9 +1083,9 @@ async def test_devices_payload_no_entities(
10841083
"model_id": "test-model-id",
10851084
"sw_version": "test-sw-version",
10861085
"via_device": None,
1086+
"entities": [],
10871087
},
10881088
{
1089-
"entities": [],
10901089
"entry_type": None,
10911090
"has_configuration_url": False,
10921091
"hw_version": None,
@@ -1095,9 +1094,9 @@ async def test_devices_payload_no_entities(
10951094
"model_id": None,
10961095
"sw_version": None,
10971096
"via_device": None,
1097+
"entities": [],
10981098
},
10991099
{
1100-
"entities": [],
11011100
"entry_type": None,
11021101
"has_configuration_url": False,
11031102
"hw_version": None,
@@ -1106,9 +1105,9 @@ async def test_devices_payload_no_entities(
11061105
"model_id": "test-model-id",
11071106
"sw_version": None,
11081107
"via_device": None,
1108+
"entities": [],
11091109
},
11101110
{
1111-
"entities": [],
11121111
"entry_type": None,
11131112
"has_configuration_url": False,
11141113
"hw_version": None,
@@ -1117,6 +1116,7 @@ async def test_devices_payload_no_entities(
11171116
"model_id": "test-model-id6",
11181117
"sw_version": None,
11191118
"via_device": ["hue", 0],
1119+
"entities": [],
11201120
},
11211121
],
11221122
"entities": [],
@@ -1233,6 +1233,14 @@ async def test_devices_payload_with_entities(
12331233
"hue": {
12341234
"devices": [
12351235
{
1236+
"entry_type": None,
1237+
"has_configuration_url": False,
1238+
"hw_version": None,
1239+
"manufacturer": "test-manufacturer",
1240+
"model": None,
1241+
"model_id": "test-model-id",
1242+
"sw_version": None,
1243+
"via_device": None,
12361244
"entities": [
12371245
{
12381246
"assumed_state": None,
@@ -1259,6 +1267,8 @@ async def test_devices_payload_with_entities(
12591267
"unit_of_measurement": None,
12601268
},
12611269
],
1270+
},
1271+
{
12621272
"entry_type": None,
12631273
"has_configuration_url": False,
12641274
"hw_version": None,
@@ -1267,8 +1277,6 @@ async def test_devices_payload_with_entities(
12671277
"model_id": "test-model-id",
12681278
"sw_version": None,
12691279
"via_device": None,
1270-
},
1271-
{
12721280
"entities": [
12731281
{
12741282
"assumed_state": None,
@@ -1279,14 +1287,6 @@ async def test_devices_payload_with_entities(
12791287
"unit_of_measurement": None,
12801288
},
12811289
],
1282-
"entry_type": None,
1283-
"has_configuration_url": False,
1284-
"hw_version": None,
1285-
"manufacturer": "test-manufacturer",
1286-
"model": None,
1287-
"model_id": "test-model-id",
1288-
"sw_version": None,
1289-
"via_device": None,
12901290
},
12911291
],
12921292
"entities": [
@@ -1402,7 +1402,6 @@ async def async_modify_analytics(
14021402
"test": {
14031403
"devices": [
14041404
{
1405-
"entities": [],
14061405
"entry_type": None,
14071406
"has_configuration_url": False,
14081407
"hw_version": None,
@@ -1411,6 +1410,7 @@ async def async_modify_analytics(
14111410
"model_id": "test-model-id",
14121411
"sw_version": None,
14131412
"via_device": None,
1413+
"entities": [],
14141414
},
14151415
],
14161416
"entities": [

0 commit comments

Comments
 (0)