Skip to content

Commit 70d3de0

Browse files
committed
Clean output, optimize
1 parent b554d96 commit 70d3de0

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

plugwise/helper.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -964,21 +964,23 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
964964
if "temperature" in data:
965965
data.pop("heating_state", None)
966966

967-
if d_id == self._heater_id:
968-
# Adam
969-
if self.smile_name == "Smile Anna":
970-
# Use elga_status_code or cooling_enabled to set _cooling_enabled to True
971-
if self._cooling_present:
972-
# Elga:
973-
if "elga_status_code" in data:
974-
self._cooling_enabled = data["elga_status_code"] in [8, 9]
975-
self._cooling_active = data["elga_status_code"] == 8
976-
data.pop("elga_status_code", None)
977-
# Loria/Thermastate: look at cooling_state, not at cooling_enabled, not available on R32!
978-
for item in ("cooling_ena_switch", "cooling_enabled"):
979-
if item in data:
980-
self._cooling_enabled = data[item]
981-
self._cooling_active = data["cooling_state"]
967+
if (
968+
d_id == self._heater_id
969+
and self.smile_name == "Smile Anna"
970+
and self._cooling_present
971+
):
972+
# Use elga_status_code or cooling_enabled to set _cooling_enabled to True
973+
if "elga_status_code" in data:
974+
self._cooling_enabled = data["elga_status_code"] in [8, 9]
975+
self._cooling_active = data["elga_status_code"] == 8
976+
data.pop("elga_status_code", None)
977+
# Loria/Thermastate: look at cooling_state, not at cooling_enabled, not available on R32!
978+
for item in ("cooling_ena_switch", "cooling_enabled"):
979+
if item in data:
980+
self._cooling_enabled = data[item]
981+
self._cooling_active = data["cooling_state"]
982+
if all(item in data for item in ("cooling_ena_switch", "cooling_enabled")):
983+
data.pop("cooling_enabled")
982984

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

0 commit comments

Comments
 (0)