Skip to content

Commit ffca9bc

Browse files
committed
Reuse function in helper.py, clear old function
1 parent abde458 commit ffca9bc

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

plugwise/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
MODULE_LOCATOR: Final = "./logs/point_log/*[@id]"
8787
NONE: Final = "None"
8888
OFF: Final = "off"
89-
PRIORITY_DEVICE_CLASSES = ("heater_central", "gateway")
89+
PRIORITY_DEVICE_CLASSES = ("gateway", "heater_central")
9090

9191
# XML data paths
9292
APPLIANCES: Final = "/core/appliances"

plugwise/helper.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
NONE,
2929
OFF,
3030
P1_MEASUREMENTS,
31-
PRIORITY_DEVICE_CLASSES,
3231
TEMP_CELSIUS,
3332
THERMOSTAT_CLASSES,
3433
TOGGLES,
@@ -160,7 +159,7 @@ def _all_appliances(self) -> None:
160159
self._get_p1_smartmeter_info()
161160

162161
# Sort the gw_entities
163-
self._sort_gw_entities()
162+
self._reorder_devices()
164163

165164
def _get_p1_smartmeter_info(self) -> None:
166165
"""For P1 collect the connected SmartMeter info from the Home/building location.
@@ -193,18 +192,6 @@ def _get_p1_smartmeter_info(self) -> None:
193192

194193
self._create_gw_entities(appl)
195194

196-
def _sort_gw_entities(self) -> None:
197-
"""Place the gateway and optional heater_central entities as 1st and 2nd."""
198-
for dev_class in PRIORITY_DEVICE_CLASSES:
199-
for entity_id, entity in dict(self.gw_entities).items():
200-
if entity["dev_class"] == dev_class:
201-
priority_entity = entity
202-
self.gw_entities.pop(entity_id)
203-
other_entities = self.gw_entities
204-
priority_entities = {entity_id: priority_entity}
205-
self.gw_entities = {**priority_entities, **other_entities}
206-
break
207-
208195
def _all_locations(self) -> None:
209196
"""Collect all locations."""
210197
loc = Munch()

0 commit comments

Comments
 (0)