Skip to content

Commit 8ee21c9

Browse files
committed
Reorder device-dict, gateway first, optional heater_central second
1 parent 562554a commit 8ee21c9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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)