|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -from typing import Any, cast |
| 5 | +from typing import Any |
6 | 6 |
|
7 | 7 | from homeassistant.components.climate import ( |
8 | 8 | ATTR_HVAC_MODE, |
@@ -251,19 +251,16 @@ def hvac_action(self) -> HVACAction: # pw-beta add to Core |
251 | 251 | self._previous_action_mode(self.coordinator) |
252 | 252 |
|
253 | 253 | # Adam provides the hvac_action for each thermostat |
254 | | - if self._gateway[SMILE_NAME] == "Adam": |
255 | | - if (control_state := self.device.get(CONTROL_STATE)) in ( |
256 | | - HVACAction.COOLING, HVACAction.HEATING, HVACAction.PREHEATING |
257 | | - ): |
258 | | - return cast(HVACAction, control_state) |
| 254 | + if (action := self.device.get(CONTROL_STATE)) is not None: |
| 255 | + return HVACAction(action) |
| 256 | + |
259 | 257 | # Anna |
260 | | - else: |
261 | | - heater: str = self._gateway["heater_id"] |
262 | | - heater_data = self._devices[heater] |
263 | | - if heater_data[BINARY_SENSORS][HEATING_STATE]: |
264 | | - return HVACAction.HEATING |
265 | | - if heater_data[BINARY_SENSORS].get(COOLING_STATE, False): |
266 | | - return HVACAction.COOLING |
| 258 | + heater: str = self._gateway["heater_id"] |
| 259 | + heater_data = self._devices[heater] |
| 260 | + if heater_data[BINARY_SENSORS][HEATING_STATE]: |
| 261 | + return HVACAction.HEATING |
| 262 | + if heater_data[BINARY_SENSORS].get(COOLING_STATE, False): |
| 263 | + return HVACAction.COOLING |
267 | 264 |
|
268 | 265 | return HVACAction.IDLE |
269 | 266 |
|
|
0 commit comments