Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
feat: Climate presets
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgermain committed Oct 8, 2023
1 parent 0936444 commit 58950e8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions custom_components/multimatic/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit 58950e8

Please sign in to comment.