|
22 | 22 | CONF_USERNAME,
|
23 | 23 | PRECISION_HALVES,
|
24 | 24 | UnitOfTemperature,
|
| 25 | + MAJOR_VERSION, |
| 26 | + MINOR_VERSION, |
25 | 27 | )
|
| 28 | + |
26 | 29 | from homeassistant.exceptions import InvalidStateError, PlatformNotReady
|
27 | 30 | import homeassistant.helpers.config_validation as cv
|
28 | 31 | from homeassistant.util import Throttle
|
|
67 | 70 | CONST_MODE_OFF: HVACMode.OFF,
|
68 | 71 | }
|
69 | 72 |
|
70 |
| -SUPPORT_FLAGS = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE |
| 73 | +SUPPORT_FLAGS = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TURN_ON |ClimateEntityFeature.TURN_OFF |
71 | 74 | SUPPORT_HVAC_HEAT = [HVACMode.HEAT, HVACMode.AUTO, HVACMode.OFF]
|
72 | 75 | SUPPORT_PRESET = [PRESET_AWAY, PRESET_HOME, PRESET_BOOST]
|
73 | 76 |
|
@@ -152,6 +155,9 @@ def __init__(self, hass, device: Warmup4IEDevice, client: WarmupClient):
|
152 | 155 | self._away = False
|
153 | 156 | self._on = True
|
154 | 157 |
|
| 158 | + # https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded |
| 159 | + self._enable_turn_on_off_backwards_compatibility = False |
| 160 | + |
155 | 161 | @property
|
156 | 162 | def name(self):
|
157 | 163 | """Return the name of the climate device."""
|
@@ -250,6 +256,14 @@ def set_hvac_mode(self, hvac_mode):
|
250 | 256 | else:
|
251 | 257 | raise InvalidStateError
|
252 | 258 |
|
| 259 | + def turn_on(self) -> None: |
| 260 | + """Turn the entity on.""" |
| 261 | + self.set_hvac_mode(HVACMode.AUTO) |
| 262 | + |
| 263 | + def turn_off(self) -> None: |
| 264 | + """Turn the entity off.""" |
| 265 | + self.set_hvac_mode(HVACMode.OFF) |
| 266 | + |
253 | 267 | def set_override(self, temperature, until):
|
254 | 268 | """Set a temperature override for this thermostat."""
|
255 | 269 | self._device.set_override(temperature, until)
|
|
0 commit comments