|
46 | 46 | POWER_WATT, |
47 | 47 | SENSORS, |
48 | 48 | SPECIAL_PLUG_TYPES, |
| 49 | + SPECIALS, |
49 | 50 | SWITCH_GROUP_TYPES, |
50 | 51 | SWITCHES, |
51 | 52 | TEMP_CELSIUS, |
|
61 | 62 | GatewayData, |
62 | 63 | ModelData, |
63 | 64 | SensorType, |
| 65 | + SpecialType, |
64 | 66 | SwitchType, |
65 | 67 | ThermoLoc, |
66 | 68 | ToggleNameType, |
@@ -860,9 +862,10 @@ def _appliance_measurements( |
860 | 862 | sw_key = cast(SwitchType, measurement) |
861 | 863 | sw_value = appl_p_loc.text in ["on", "true"] |
862 | 864 | data["switches"][sw_key] = sw_value |
863 | | - case "c_heating_state": |
864 | | - value = appl_p_loc.text in ["on", "true"] |
865 | | - data["c_heating_state"] = value |
| 865 | + case _ as measurement if measurement in SPECIALS: |
| 866 | + sp_key = cast(SpecialType, measurement) |
| 867 | + sp_value = appl_p_loc.text in ["on", "true"] |
| 868 | + data[sp_key] = sp_value |
866 | 869 | case "elga_status_code": |
867 | 870 | data["elga_status_code"] = int(appl_p_loc.text) |
868 | 871 |
|
@@ -1003,10 +1006,14 @@ def _cleanup_data(self, data: DeviceData) -> None: |
1003 | 1006 | if "cooling_ena_switch" in data["switches"]: |
1004 | 1007 | data["switches"].pop("cooling_ena_switch") # pragma: no cover |
1005 | 1008 | self._count -= 1 # pragma: no cover |
1006 | | - if not self._elga and "cooling_enabled" in data: |
1007 | | - 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 |
1008 | 1011 | self._count -= 1 # pragma: no cover |
1009 | 1012 |
|
| 1013 | + if "thermostat_supports_cooling" in data: |
| 1014 | + data.pop("thermostat_supports_cooling", None) |
| 1015 | + self._count -= 1 |
| 1016 | + |
1010 | 1017 | def _process_c_heating_state(self, data: DeviceData) -> None: |
1011 | 1018 | """Helper-function for _get_measurement_data(). |
1012 | 1019 |
|
@@ -1100,19 +1107,21 @@ def _get_measurement_data(self, dev_id: str) -> DeviceData: |
1100 | 1107 | if self._is_thermostat and self.smile(ANNA) and dev_id == self._heater_id: |
1101 | 1108 | # Anna+Elga: base cooling_state on the elga-status-code |
1102 | 1109 | if "elga_status_code" in data: |
1103 | | - # Techneco Elga has cooling-capability |
1104 | | - self._cooling_present = True |
1105 | | - data["model"] = "Generic heater/cooler" |
1106 | | - self._cooling_enabled = data["elga_status_code"] in [8, 9] |
1107 | | - data["binary_sensors"]["cooling_state"] = self._cooling_active = ( |
1108 | | - data["elga_status_code"] == 8 |
1109 | | - ) |
| 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 | + |
1110 | 1123 | data.pop("elga_status_code", None) |
1111 | 1124 | self._count -= 1 |
1112 | | - # Elga has no cooling-switch |
1113 | | - if "cooling_ena_switch" in data["switches"]: |
1114 | | - data["switches"].pop("cooling_ena_switch") |
1115 | | - self._count -= 1 |
1116 | 1125 |
|
1117 | 1126 | # Loria/Thermastage: cooling-related is based on cooling_state |
1118 | 1127 | # and modulation_level |
|
0 commit comments