Skip to content

Commit f5b3227

Browse files
committed
Change the THERMO_MATCHING constant
1 parent 07c553e commit f5b3227

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 (
@@ -830,16 +828,10 @@ def _match_and_rank_thermostats(self) -> dict[str, ThermoLoc]:
830828
831829
Match thermostat-appliances with locations, rank them for locations with multiple thermostats.
832830
"""
833-
thermo_matching: dict[str, int] = {
834-
"thermostat": 2,
835-
"zone_thermometer": 2,
836-
"zone_thermostat": 2,
837-
"thermostatic_radiator_valve": 1,
838-
}
839831
for location_id, location in self._loc_data.items():
840832
for entity_id, entity in self.gw_entities.items():
841833
self._rank_thermostat(
842-
entity_id, entity, location_id, location, thermo_matching
834+
entity_id, entity, location_id, location, THERMO_MATCHING
843835
)
844836

845837
def _rank_thermostat(

0 commit comments

Comments
 (0)