From 58950e86e3b461458d5062c0ff72000356436a98 Mon Sep 17 00:00:00 2001 From: Thomas Germain <12560542+thomasgermain@users.noreply.github.com> Date: Sun, 8 Oct 2023 11:30:35 +0200 Subject: [PATCH] feat: Climate presets --- custom_components/multimatic/climate.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/custom_components/multimatic/climate.py b/custom_components/multimatic/climate.py index d54e1d6..63f7b56 100644 --- a/custom_components/multimatic/climate.py +++ b/custom_components/multimatic/climate.py @@ -363,8 +363,9 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None: async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new target preset mode.""" - mode = RoomClimate._HA_PRESET_TO_MULTIMATIC[preset_mode] - await self.coordinator.api.set_room_operating_mode(self, mode) + if preset_mode != "": + mode = RoomClimate._HA_PRESET_TO_MULTIMATIC[preset_mode] + await self.coordinator.api.set_room_operating_mode(self, mode) @property def hvac_action(self) -> HVACAction: @@ -468,8 +469,9 @@ def hvac_action(self) -> HVACAction | None: async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new target preset mode.""" - mode = self._ha_preset()[preset_mode] - await self.coordinator.api.set_zone_operating_mode(self, mode) + if preset_mode != "": + mode = self._ha_preset()[preset_mode] + await self.coordinator.api.set_zone_operating_mode(self, mode) class ZoneClimate(AbstractZoneClimate): @@ -636,9 +638,10 @@ def hvac_mode(self) -> HVACMode | None: async def async_set_preset_mode(self, preset_mode: str) -> None: """Set new target preset mode.""" - mode = DHWClimate._HA_PRESET_TO_MULTIMATIC[preset_mode] - _LOGGER.info("Will set %s operation mode to hot water", mode) - await self.coordinator.api.set_hot_water_operating_mode(self, mode) + if preset_mode != "": + mode = DHWClimate._HA_PRESET_TO_MULTIMATIC[preset_mode] + _LOGGER.info("Will set %s operation mode to hot water", mode) + await self.coordinator.api.set_hot_water_operating_mode(self, mode) async def async_set_temperature(self, **kwargs: Any) -> None: """Set new target temperature."""