Skip to content

Commit afa11c9

Browse files
authored
Merge pull request #404 from plugwise/reorder_device_data
Reorder device-dicts
2 parents 562554a + 51b8e7e commit afa11c9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Ongoing
44

5+
- Reorder device-dicts: gateway first, optionally heater_central second
56
- Improve handling of obsolete sensors (solution for [HA Core issue #100306](https://github.com/home-assistant/core/issues/100306)
67
- Improve handling of invalid actuator xml-data (partial solution for [HA Core issue #99372](https://github.com/home-assistant/core/issues/99372)
78

plugwise/helper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,16 @@ def _all_appliances(self) -> None:
717717
# Leave for-loop to avoid a 2nd device_id switch
718718
break
719719

720+
# Place the gateway and optional heater_central devices as 1st and 2nd
721+
for dev_class in ("heater_central", "gateway"):
722+
for dev_id, device in dict(self.gw_devices).items():
723+
if device["dev_class"] == dev_class:
724+
tmp_device = device
725+
self.gw_devices.pop(dev_id)
726+
cleared_dict = self.gw_devices
727+
add_to_front = {dev_id: tmp_device}
728+
self.gw_devices = {**add_to_front, **cleared_dict}
729+
720730
def _match_locations(self) -> dict[str, ThermoLoc]:
721731
"""Helper-function for _scan_thermostats().
722732

0 commit comments

Comments
 (0)