Skip to content

Commit bcc0f7f

Browse files
committed
Revert back to (_)elga_cooling_* / (_)lortherm_cooling?*
1 parent 72d29e5 commit bcc0f7f

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

plugwise/helper.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -316,18 +316,22 @@ def __init__(self) -> None:
316316
self._stretch_v3 = False
317317
self._thermo_locs: dict[str, ThermoLoc] = {}
318318

319-
#####################################################################
320-
# 'anna_cooling_enabled' refers 1) to the state of the Elga heatpump
319+
###################################################################
320+
# 'elga_cooling_enabled' refers to the state of the Elga heatpump
321321
# connected to an Anna. For Elga, 'elga_status_code' in [8, 9]
322322
# means cooling mode is available, next to heating mode.
323323
# 'elga_status_code' = 8 means cooling is active, 9 means idle.
324-
# 2) it also refers to the state of the Loria or Thermastage heatpump
325-
# connected to an Anna. For these, 'cooling_state' = on means set
326-
# to cooling mode, next of to heating mode.
324+
#
325+
# 'lortherm_cooling_enabled' refers to the state of the Loria or
326+
# Thermastage heatpump connected to an Anna. For these,
327+
# 'cooling_state' = on means set to cooling mode, instead of to
328+
# heating mode.
327329
# 'modulation_level' = 100 means cooling is active, 0.0 means idle.
328-
#####################################################################
329-
self._anna_cooling_active = False
330-
self.anna_cooling_enabled = False
330+
###################################################################
331+
self._elga_cooling_active = False
332+
self.elga_cooling_enabled = False
333+
self._lortherm_cooling_active = False
334+
self.lortherm_cooling_enabled = False
331335

332336
self.gateway_id: str
333337
self.gw_data: GatewayData = {}
@@ -875,16 +879,15 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
875879
if self._anna_cooling_present:
876880
# Elga:
877881
if "elga_status_code" in data:
878-
self.anna_cooling_enabled = data["elga_status_code"] in [8, 9]
879-
self._anna_cooling_active = data["elga_status_code"] == 8
882+
self.elga_cooling_enabled = data["elga_status_code"] in [8, 9]
883+
self._elga_cooling_active = data["elga_status_code"] == 8
880884
data.pop("elga_status_code", None)
881885
# Loria/Thermastate:
882886
elif "cooling_state" in data:
883-
self.anna_cooling_enabled = data["cooling_state"]
887+
self.lortherm_cooling_enabled = data["cooling_state"]
888+
self._lortherm_cooling_active = False
884889
if data["modulation_level"] == 100:
885-
self._anna_cooling_active = True
886-
if data["modulation_level"] == 0.0:
887-
self._anna_cooling_active = False
890+
self._lortherm_cooling_active = True
888891

889892
# Don't show cooling_state when no cooling present
890893
if not self._cooling_present and "cooling_state" in data:

plugwise/smile.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ def update_for_cooling(self, devices: dict[str, DeviceData]) -> None:
5959
if self.smile_name == "Anna":
6060
if device["dev_class"] == "heater_central" and self._cooling_present:
6161
device["binary_sensors"]["cooling_state"] = False
62-
if self._anna_cooling_active:
62+
if self._elga_cooling_active:
6363
device["binary_sensors"]["cooling_state"] = True
6464

6565
# Add setpoint_low and setpoint_high when cooling is enabled
6666
if device["dev_class"] not in ZONE_THERMOSTATS:
6767
continue
6868

69-
if self.anna_cooling_enabled:
69+
if self.elga_cooling_enabled:
7070
sensors = device["sensors"]
7171
sensors["setpoint_low"] = sensors["setpoint"]
7272
sensors["setpoint_high"] = MAX_SETPOINT
73-
if self._anna_cooling_active:
73+
if self._elga_cooling_active:
7474
sensors["setpoint_low"] = MIN_SETPOINT
7575
sensors["setpoint_high"] = sensors["setpoint"]
7676
if self._sched_setpoints is not None:
@@ -231,9 +231,9 @@ def _device_data_climate(
231231
device_data["mode"] = "auto"
232232
if sel_schedule == "None":
233233
device_data["mode"] = "heat"
234-
if self.anna_cooling_enabled:
234+
if self.elga_cooling_enabled:
235235
device_data["mode"] = "heat_cool"
236-
if self._adam_cooling_enabled:
236+
if self._adam_cooling_enabled or self.lortherm_cooling_enabled:
237237
device_data["mode"] = "cool"
238238

239239
return device_data
@@ -643,7 +643,7 @@ async def set_temperature(self, loc_id: str, temps: dict[str, Any]) -> None:
643643
"""Set the given Temperature on the relevant Thermostat."""
644644
if "setpoint" in temps:
645645
setpoint = temps["setpoint"]
646-
elif self._anna_cooling_active:
646+
elif self._elga_cooling_active:
647647
setpoint = temps["setpoint_high"]
648648
else:
649649
setpoint = temps["setpoint_low"]

tests/test_smile.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,8 @@ async def test_connect_anna_v4(self):
944944
assert not self.notifications
945945

946946
assert not smile._anna_cooling_present
947-
assert not smile._anna_cooling_active
948-
assert not smile.anna_cooling_enabled
947+
assert not smile._elga_cooling_active
948+
assert not smile.elga_cooling_enabled
949949

950950
result = await self.tinker_thermostat(
951951
smile,
@@ -3055,8 +3055,8 @@ async def test_connect_anna_heatpump_heating(self):
30553055
assert not self.notifications
30563056

30573057
assert smile._anna_cooling_present
3058-
assert smile.anna_cooling_enabled
3059-
assert not smile._anna_cooling_active
3058+
assert smile.elga_cooling_enabled
3059+
assert not smile._elga_cooling_active
30603060

30613061
result = await self.tinker_thermostat(
30623062
smile,
@@ -3130,8 +3130,8 @@ async def test_connect_anna_heatpump_cooling(self):
31303130
assert not self.notifications
31313131

31323132
assert smile._anna_cooling_present
3133-
assert smile.anna_cooling_enabled
3134-
assert smile._anna_cooling_active
3133+
assert smile.elga_cooling_enabled
3134+
assert smile._elga_cooling_active
31353135

31363136
result = await self.tinker_thermostat(
31373137
smile,
@@ -3185,8 +3185,8 @@ async def test_connect_anna_heatpump_cooling_fake_firmware(self):
31853185

31863186
await self.device_test(smile, testdata)
31873187
assert smile._anna_cooling_present
3188-
assert smile.anna_cooling_enabled
3189-
assert smile._anna_cooling_active
3188+
assert smile.lortherm_cooling_enabled
3189+
assert smile._lortherm_cooling_active
31903190

31913191
await smile.close_connection()
31923192
await self.disconnect(server, client)
@@ -3224,8 +3224,8 @@ async def test_connect_anna_loria_idle_fake_firmware(self):
32243224

32253225
await self.device_test(smile, testdata)
32263226
assert smile._anna_cooling_present
3227-
assert smile.anna_cooling_enabled
3228-
assert not smile._anna_cooling_active
3227+
assert smile.lortherm_cooling_enabled
3228+
assert not smile._lortherm_cooling_active
32293229

32303230
await smile.close_connection()
32313231
await self.disconnect(server, client)
@@ -3485,8 +3485,8 @@ async def test_connect_anna_elga_2_cooling(self):
34853485
assert not self.notifications
34863486

34873487
assert smile._anna_cooling_present
3488-
assert smile.anna_cooling_enabled
3489-
assert smile._anna_cooling_active
3488+
assert smile.elga_cooling_enabled
3489+
assert smile._elga_cooling_active
34903490

34913491
await smile.close_connection()
34923492
await self.disconnect(server, client)

0 commit comments

Comments
 (0)