From 0ac5769d64848b8c46feb69c6260dc7a53bd3242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Seux?= Date: Sat, 10 Feb 2024 14:15:37 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Support=20turn=5Fon/off=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is now mandatory Fix #197 Reference: https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded/ --- custom_components/aquarea/climate.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/custom_components/aquarea/climate.py b/custom_components/aquarea/climate.py index bebedec..d56b98a 100644 --- a/custom_components/aquarea/climate.py +++ b/custom_components/aquarea/climate.py @@ -125,7 +125,8 @@ def __init__( self._attr_unique_id = f"{config_entry.entry_id}-{self.zone_id}" self._attr_temperature_unit = "°C" - self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE + self._enable_turn_on_off_backwards_compatibility = False + self._attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON self._attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF] self._attr_hvac_mode = HVACMode.OFF @@ -137,6 +138,12 @@ def __init__( self._mode = ZoneTemperatureMode.DIRECT self.change_mode(ZoneTemperatureMode.DIRECT, initialization=True) + async def async_turn_off(self) -> None: + await self.async_set_hvac_mode(HVACMode.OFF) + + async def async_turn_on(self) -> None: + await self.async_set_hvac_mode(HVACMode.HEATING) + def evaluate_temperature_mode(self): mode = self._mode if self._sensor_mode == ZoneSensorMode.INTERNAL: