Skip to content

Commit 8bdcf7f

Browse files
committed
Implement improvement suggestions
1 parent 47de0e2 commit 8bdcf7f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

plugwise/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
MODULE_LOCATOR: Final = "./logs/point_log/*[@id]"
8686
NONE: Final = "None"
8787
OFF: Final = "off"
88+
PRIORITY_DEVICE_CLASSES = ("heater_central", "gateway")
8889

8990
# XML data paths
9091
APPLIANCES: Final = "/core/appliances"

plugwise/helper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
NONE,
3030
OFF,
3131
P1_MEASUREMENTS,
32+
PRIORITY_DEVICE_CLASSES,
3233
TEMP_CELSIUS,
3334
THERMOSTAT_CLASSES,
3435
TOGGLES,
@@ -344,6 +345,8 @@ def _get_smartmeter_info(self) -> None:
344345
"""For P1 collect the connected SmartMeter info from the Home/buildinglocation.
345346
346347
There is no appliance available for this device.
348+
Note: For P1 devices, we switch the gateway_id to the smartmeter device_id
349+
to maintain backward compatibility with existing implementations.
347350
"""
348351
if self.smile_type == "power":
349352
self._p1_smartmeter_info_finder()
@@ -356,7 +359,7 @@ def _get_smartmeter_info(self) -> None:
356359

357360
def _sort_gw_entities(self) -> None:
358361
"""Place the gateway and optional heater_central devices as 1st and 2nd."""
359-
for dev_class in ("heater_central", "gateway"):
362+
for dev_class in PRIORITY_DEVICE_CLASSES:
360363
for entity_id, entity in dict(self.gw_entities).items():
361364
if entity["dev_class"] == dev_class:
362365
priority_entity = entity

0 commit comments

Comments
 (0)