Skip to content

Commit fc38497

Browse files
committed
Improve comments, add missed data["cooling_state"] init
1 parent 3e8bee0 commit fc38497

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

plugwise/helper.py

Lines changed: 9 additions & 7 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,16 +960,16 @@ 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
971972
if self._elga:
972-
# Anna + Elga: use central_heating_state to show heating_state
973973
data["heating_state"] = data["c_heating_state"]
974974

975975
def _get_appliance_data(self, d_id: str) -> DeviceData:
@@ -1011,8 +1011,8 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
10111011
data.pop("c_heating_state")
10121012

10131013
if d_id == self._heater_id and self.smile_name == "Smile Anna":
1014+
# Anna+Elga: base cooling_state on the elga-status-code
10141015
if "elga_status_code" in data:
1015-
# Base cooling_state on the elga-status-code
10161016
data["cooling_state"] = self._cooling_active = (
10171017
data["elga_status_code"] == 8
10181018
)
@@ -1026,8 +1026,10 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
10261026
# Elga has no cooling-switch
10271027
if "cooling_ena_switch" in data:
10281028
data.pop("cooling_ena_switch")
1029+
1030+
# Loria/Thermastage: cooling-related is based on cooling_state
1031+
# and modulation_level
10291032
else:
1030-
# Loria/Thermastage: cooling-related is based on cooling_state and modulation_level
10311033
if self._cooling_present and "cooling_state" in data:
10321034
self._cooling_enabled = data["cooling_state"]
10331035
self._cooling_active = data["modulation_level"] == 100

0 commit comments

Comments
 (0)