Skip to content

Commit fe29ba4

Browse files
committed
Fix removing unwanted keys
1 parent 0c807bc commit fe29ba4

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

plugwise/helper.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,8 @@ def _cleanup_data(self, data: DeviceData) -> None:
10061006
if "cooling_ena_switch" in data["switches"]:
10071007
data["switches"].pop("cooling_ena_switch") # pragma: no cover
10081008
self._count -= 1 # pragma: no cover
1009-
if "cooling_enabled" in data:
1010-
data.pop("cooling_enabled") # pragma: no cover
1009+
if "cooling_enabled" in data["binary_sensors"]:
1010+
data["binary_sensors"].pop("cooling_enabled") # pragma: no cover
10111011
self._count -= 1 # pragma: no cover
10121012

10131013
if "thermostat_supports_cooling" in data:
@@ -1106,20 +1106,22 @@ def _get_measurement_data(self, dev_id: str) -> DeviceData:
11061106

11071107
if self._is_thermostat and self.smile(ANNA) and dev_id == self._heater_id:
11081108
# Anna+Elga: base cooling_state on the elga-status-code
1109-
if "elga_status_code" in data and data["thermostat_supports_cooling"]:
1110-
# Techneco Elga has cooling-capability
1111-
self._cooling_present = True
1112-
data["model"] = "Generic heater/cooler"
1113-
self._cooling_enabled = data["elga_status_code"] in [8, 9]
1114-
data["binary_sensors"]["cooling_state"] = self._cooling_active = (
1115-
data["elga_status_code"] == 8
1116-
)
1109+
if "elga_status_code" in data:
1110+
if data["thermostat_supports_cooling"]:
1111+
# Techneco Elga has cooling-capability
1112+
self._cooling_present = True
1113+
data["model"] = "Generic heater/cooler"
1114+
self._cooling_enabled = data["elga_status_code"] in [8, 9]
1115+
data["binary_sensors"]["cooling_state"] = self._cooling_active = (
1116+
data["elga_status_code"] == 8
1117+
)
1118+
# Elga has no cooling-switch
1119+
if "cooling_ena_switch" in data["switches"]:
1120+
data["switches"].pop("cooling_ena_switch")
1121+
self._count -= 1
1122+
11171123
data.pop("elga_status_code", None)
11181124
self._count -= 1
1119-
# Elga has no cooling-switch
1120-
if "cooling_ena_switch" in data["switches"]:
1121-
data["switches"].pop("cooling_ena_switch")
1122-
self._count -= 1
11231125

11241126
# Loria/Thermastage: cooling-related is based on cooling_state
11251127
# and modulation_level

0 commit comments

Comments
 (0)