Skip to content

Commit 16b054b

Browse files
committed
fix multizone flow temperatures
1 parent 8584582 commit 16b054b

File tree

5 files changed

+32
-22
lines changed

5 files changed

+32
-22
lines changed

examples/example.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ async def main() -> None:
2727
try:
2828
# Call the login method with the session
2929
token = await pymelcloud.login(
30-
31-
password="mysecretpassword", # noqa: S106
30+
31+
password="Mm:=7894are", # noqa: S106
3232
session=session,
3333
)
3434
logger.info("Login successful, token: %s", token)

src/pymelcloud/atw_device.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ def flow_temperature(self) -> float:
161161
This value is not available in the standard state poll response. The poll
162162
update frequency can be a little bit lower that expected.
163163
"""
164-
return self._device_conf()["Device"]["FlowTemperature"]
164+
temp = self._device_conf()["Device"].get(f"FlowTemperatureZone{self.zone_index}")
165+
166+
if temp is None:
167+
return self._device_conf()["Device"]["FlowTemperature"] # backward compatibility if it is needed
168+
169+
return temp
165170

166171
@property
167172
def return_temperature(self) -> float:
@@ -170,7 +175,12 @@ def return_temperature(self) -> float:
170175
This value is not available in the standard state poll response. The poll
171176
update frequency can be a little bit lower that expected.
172177
"""
173-
return self._device_conf()["Device"]["ReturnTemperature"]
178+
temp = self._device_conf()["Device"].get(f"ReturnTemperatureZone{self.zone_index}")
179+
180+
if temp is None:
181+
return self._device_conf()["Device"]["ReturnTemperature"] # backward compatibility if it is needed
182+
183+
return temp
174184

175185
@property
176186
def target_flow_temperature(self) -> Optional[float]:

tests/samples/atw_1zone_listdevice.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@
6161
"RoomTemperatureZone2": -39,
6262
"OutdoorTemperature": 13,
6363
"FlowTemperature": 57.5,
64-
"FlowTemperatureZone1": 25,
65-
"FlowTemperatureZone2": 25,
64+
"FlowTemperatureZone1": 28,
65+
"FlowTemperatureZone2": 29,
6666
"FlowTemperatureBoiler": 25,
6767
"ReturnTemperature": 53,
68-
"ReturnTemperatureZone1": 25,
69-
"ReturnTemperatureZone2": 25,
68+
"ReturnTemperatureZone1": 26,
69+
"ReturnTemperatureZone2": 27,
7070
"ReturnTemperatureBoiler": 25,
7171
"BoilerStatus": false,
7272
"BoosterHeater1Status": false,

tests/samples/atw_2zone_listdevice.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@
9797
"RoomTemperatureZone2": 19.5,
9898
"OutdoorTemperature": 4.0,
9999
"FlowTemperature": 36.0,
100-
"FlowTemperatureZone1": 25.0,
101-
"FlowTemperatureZone2": 25.0,
100+
"FlowTemperatureZone1": 29.0,
101+
"FlowTemperatureZone2": 28.0,
102102
"FlowTemperatureBoiler": 25.0,
103103
"ReturnTemperature": 30.0,
104-
"ReturnTemperatureZone1": 25.0,
105-
"ReturnTemperatureZone2": 25.0,
104+
"ReturnTemperatureZone1": 27.0,
105+
"ReturnTemperatureZone2": 26.0,
106106
"ReturnTemperatureBoiler": 25.0,
107107
"BoilerStatus": false,
108108
"BoosterHeater1Status": false,

tests/test_atw_properties.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ async def test_1zone():
6060
assert zones[0].zone_index == 1
6161
assert zones[0].room_temperature is None
6262
assert zones[0].target_temperature is None
63-
assert zones[0].flow_temperature == 57.5
64-
assert zones[0].return_temperature == 53.0
63+
assert zones[0].flow_temperature == 28.0
64+
assert zones[0].return_temperature == 26.0
6565
assert zones[0].target_flow_temperature is None
6666
assert zones[0].operation_mode is None
6767
assert zones[0].operation_modes == [
@@ -130,8 +130,8 @@ async def test_2zone():
130130
assert zones[0].zone_index == 1
131131
assert zones[0].room_temperature is None
132132
assert zones[0].target_temperature is None
133-
assert zones[0].flow_temperature == 36.0
134-
assert zones[0].return_temperature == 30.0
133+
assert zones[0].flow_temperature == 29.0
134+
assert zones[0].return_temperature == 27.0
135135
assert zones[0].target_flow_temperature is None
136136
assert zones[0].operation_mode is None
137137
assert zones[0].operation_modes == [
@@ -145,8 +145,8 @@ async def test_2zone():
145145
assert zones[1].zone_index == 2
146146
assert zones[1].room_temperature is None
147147
assert zones[1].target_temperature is None
148-
assert zones[1].flow_temperature == 36.0
149-
assert zones[1].return_temperature == 30.0
148+
assert zones[1].flow_temperature == 28.0
149+
assert zones[1].return_temperature == 26.0
150150
assert zones[1].target_flow_temperature is None
151151
assert zones[1].operation_mode is None
152152
assert zones[1].operation_modes == [
@@ -228,8 +228,8 @@ async def test_2zone_cancool():
228228
assert zones[0].zone_index == 1
229229
assert zones[0].room_temperature is None
230230
assert zones[0].target_temperature is None
231-
assert zones[0].flow_temperature == 50.5
232-
assert zones[0].return_temperature == 50.5
231+
assert zones[0].flow_temperature == 22.0
232+
assert zones[0].return_temperature == 21.0
233233
assert zones[0].target_flow_temperature is None
234234
assert zones[0].operation_mode is None
235235
assert zones[0].operation_modes == [
@@ -245,8 +245,8 @@ async def test_2zone_cancool():
245245
assert zones[1].zone_index == 2
246246
assert zones[1].room_temperature is None
247247
assert zones[1].target_temperature is None
248-
assert zones[1].flow_temperature == 50.5
249-
assert zones[1].return_temperature == 50.5
248+
assert zones[1].flow_temperature == 21.0
249+
assert zones[1].return_temperature == 21.0
250250
assert zones[1].target_flow_temperature is None
251251
assert zones[1].operation_mode is None
252252
assert zones[1].operation_modes == [

0 commit comments

Comments
 (0)