Skip to content

Commit 3d78bf4

Browse files
authored
Merge pull request #286 from plugwise/elga_heating
Final fix for plugwise/plugwise-beta#320
2 parents 313cde6 + bff2b82 commit 3d78bf4

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
## v0.27.10: Anna + Elga: final fix for [#320](https://github.com/plugwise/plugwise-beta/issues/320)
4+
35
## v0.27.9: P1 legacy: collect data from /core/modules
46

57
- Collect P1 legacy data from /core/modules - fix for [#368](https://github.com/plugwise/plugwise-beta/issues/368)

plugwise/helper.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -940,12 +940,12 @@ def _cleanup_data(self, data: dict[str, Any]) -> None:
940940
if "temperature" in data:
941941
data.pop("heating_state", None)
942942

943-
# Don't show cooling-related when no cooling present
943+
# Don't show cooling-related when no cooling present,
944+
# but, keep cooling_enabled for Elga
944945
if not self._cooling_present:
945946
for item in ("cooling_state", "cooling_ena_switch"):
946947
if item in data:
947948
data.pop(item)
948-
# Keep cooling_enabled for Elga
949949
if not self._elga and "cooling_enabled" in data:
950950
data.pop("cooling_enabled") # pragma: no cover
951951

@@ -960,14 +960,18 @@ def _process_c_heating_state(self, data: dict[str, Any]) -> None:
960960
if self.smile_name == "Smile Anna":
961961
data["heating_state"] = data["c_heating_state"]
962962

963+
# Adam + OnOff cooling: use central_heating_state to show heating/cooling_state
963964
if self.smile_name == "Adam":
964-
data["heating_state"] = False
965-
# Adam + OnOff cooling: use central_heating_state to show heating/cooling_state
965+
data["cooling_state"] = data["heating_state"] = False
966966
if self._cooling_enabled:
967967
data["cooling_state"] = data["c_heating_state"]
968968
else:
969969
data["heating_state"] = data["c_heating_state"]
970970

971+
# Anna + Elga: use central_heating_state to show heating_state
972+
if self._elga:
973+
data["heating_state"] = data["c_heating_state"]
974+
971975
def _get_appliance_data(self, d_id: str) -> DeviceData:
972976
"""Helper-function for smile.py: _get_device_data().
973977
@@ -1007,17 +1011,11 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
10071011
data.pop("c_heating_state")
10081012

10091013
if d_id == self._heater_id and self.smile_name == "Smile Anna":
1014+
# Anna+Elga: base cooling_state on the elga-status-code
10101015
if "elga_status_code" in data:
1011-
# Base heating_/cooling_state on the elga-status-code
1012-
data["heating_state"] = False
1013-
data["cooling_state"] = False
1014-
if data["elga_status_code"] in [4, 10] or (
1015-
data["elga_status_code"] in [3, 5, 6, 11] and not data["dhw_state"]
1016-
):
1017-
data["heating_state"] = True
1018-
if data["elga_status_code"] == 8:
1019-
data["cooling_state"] = self._cooling_active = True
1020-
1016+
data["cooling_state"] = self._cooling_active = (
1017+
data["elga_status_code"] == 8
1018+
)
10211019
data.pop("elga_status_code", None)
10221020

10231021
# Determine _cooling_present and _cooling_enabled
@@ -1028,8 +1026,10 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
10281026
# Elga has no cooling-switch
10291027
if "cooling_ena_switch" in data:
10301028
data.pop("cooling_ena_switch")
1029+
1030+
# Loria/Thermastage: cooling-related is based on cooling_state
1031+
# and modulation_level
10311032
else:
1032-
# Loria/Thermastage: cooling-related is based on cooling_state and modulation_level
10331033
if self._cooling_present and "cooling_state" in data:
10341034
self._cooling_enabled = data["cooling_state"]
10351035
self._cooling_active = data["modulation_level"] == 100

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "plugwise"
7-
version = "0.27.9"
7+
version = "0.27.10"
88
license = {file = "LICENSE"}
99
description = "Plugwise Smile (Adam/Anna/P1), Stretch and USB (Stick) module for Python 3."
1010
readme = "README.md"

0 commit comments

Comments
 (0)