Skip to content

Commit 3f67ea5

Browse files
committed
Change the THERMO_MATCHING constant
1 parent b09eea4 commit 3f67ea5

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

plugwise/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@
9292
NONE: Final = "None"
9393
OFF: Final = "off"
9494
PRIORITY_DEVICE_CLASSES = ("gateway", "heater_central")
95+
THERMO_MATCHING: dict[str, int] = {
96+
"thermostat": 2,
97+
"zone_thermometer": 2,
98+
"zone_thermostat": 2,
99+
"thermostatic_radiator_valve": 1,
100+
}
95101

96102
# XML data paths
97103
APPLIANCES: Final = "/core/appliances"

plugwise/helper.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
OFF,
3131
P1_MEASUREMENTS,
3232
TEMP_CELSIUS,
33+
THERMO_MATCHING,
3334
THERMOSTAT_CLASSES,
3435
TOGGLES,
3536
UOM,
@@ -162,12 +163,9 @@ def _get_appliances(self) -> bool:
162163

163164
removed = list(set(self._existing_appliances) - set(self._new_appliances))
164165
if self._existing_appliances:
165-
if not removed:
166-
return False
167-
else:
168-
for appliance in removed:
169-
self.gw_entities.pop(appliance)
170-
return False
166+
for appliance in removed:
167+
self.gw_entities.pop(appliance)
168+
return False
171169

172170
# A smartmeter is not present as an appliance, add it specifically
173171
if not self._existing_appliances and (
@@ -832,16 +830,10 @@ def _match_and_rank_thermostats(self) -> dict[str, ThermoLoc]:
832830
833831
Match thermostat-appliances with locations, rank them for locations with multiple thermostats.
834832
"""
835-
thermo_matching: dict[str, int] = {
836-
"thermostat": 2,
837-
"zone_thermometer": 2,
838-
"zone_thermostat": 2,
839-
"thermostatic_radiator_valve": 1,
840-
}
841833
for location_id, location in self._loc_data.items():
842834
for entity_id, entity in self.gw_entities.items():
843835
self._rank_thermostat(
844-
entity_id, entity, location_id, location, thermo_matching
836+
entity_id, entity, location_id, location, THERMO_MATCHING
845837
)
846838

847839
def _rank_thermostat(

0 commit comments

Comments
 (0)