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 705d331 commit 0936444
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 64 deletions.
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ This will allow you to create some buttons in UI to activate/deactivate quick mo

#### Modes mapping

| Multimatic mode | HA HVAC | HA preset |
|-------------------------|------------------|----------------------------|
| AUTO | AUTO | COMFORT |
| OFF | OFF | / |
| QUICK_VETO | Depends on state | PRESET_QUICK_VETO (custom) |
| SYSTEM_OFF (quick mode) | OFF | PRESET_SYSTEM_OFF (custom) |
| HOLIDAY (quick mode) | OFF | PRESET_AWAY |
| MANUAL | Depends on state | PRESET_HOME |
| Multimatic mode | HA HVAC | HA preset |
|-------------------------|---------|----------------------------|
| AUTO | AUTO | COMFORT |
| OFF | OFF | / |
| QUICK_VETO | HEAT | PRESET_QUICK_VETO (custom) |
| SYSTEM_OFF (quick mode) | OFF | PRESET_SYSTEM_OFF (custom) |
| HOLIDAY (quick mode) | OFF | PRESET_AWAY |
| MANUAL | HEAT | PRESET_HOME |

#### Available HVAC mode

Expand All @@ -137,22 +137,22 @@ configurable for a zone)

#### Modes mapping

| Vaillant Mode | HA HVAC | HA preset |
|---------------------------------|------------------|----------------------------|
| AUTO / TIMED CONTROLLED | AUTO | PRESET_COMFORT |
| DAY | Depends on state | PRESET_HOME |
| NIGHT | Depends on state | PRESET_SLEEP |
| MANUAL (= cooling) | Depends on state | PRESET_COOLING_ON |
| OFF | OFF | / |
| ON (= cooling ON) | Depends on state | PRESET_COOLING_ON (custom) |
| QUICK_VETO | Depends on state | PRESET_QUICK_VETO (custom) |
| ONE_DAY_AT_HOME (quick mode) | AUTO | PRESET_HOME |
| PARTY (quick mode) | OFF | PRESET_HOME |
| VENTILATION_BOOST (quick mode) | FAN_ONLY | / |
| ONE_DAY_AWAY (quick mode) | OFF | PRESET_AWAY |
| SYSTEM_OFF (quick mode) | OFF | PRESET_SYSTEM_OFF (custom) |
| HOLIDAY (quick mode) | OFF | PRESET_AWAY |
| COOLING_FOR_X_DAYS (quick mode) | COOL | / |
| Vaillant Mode | HA HVAC | HA preset |
|---------------------------------|----------|----------------------------|
| AUTO / TIMED CONTROLLED | AUTO | PRESET_COMFORT |
| DAY | HEAT | PRESET_HOME |
| NIGHT | OFF | PRESET_SLEEP |
| MANUAL (= cooling) | COOL | PRESET_COOLING_ON |
| OFF | OFF | / |
| ON (= cooling ON) | COOL | PRESET_COOLING_ON (custom) |
| QUICK_VETO | HEAT | PRESET_QUICK_VETO (custom) |
| ONE_DAY_AT_HOME (quick mode) | AUTO | PRESET_HOME |
| PARTY (quick mode) | OFF | PRESET_HOME |
| VENTILATION_BOOST (quick mode) | FAN_ONLY | / |
| ONE_DAY_AWAY (quick mode) | OFF | PRESET_AWAY |
| SYSTEM_OFF (quick mode) | OFF | PRESET_SYSTEM_OFF (custom) |
| HOLIDAY (quick mode) | OFF | PRESET_AWAY |
| COOLING_FOR_X_DAYS (quick mode) | COOL | / |

#### Available HVAC mode

Expand Down
52 changes: 12 additions & 40 deletions custom_components/multimatic/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ class RoomClimate(MultimaticClimate):
_MULTIMATIC_TO_HA: dict[Mode, list] = {
OperatingModes.AUTO: [HVACMode.AUTO, PRESET_COMFORT],
OperatingModes.OFF: [HVACMode.OFF, PRESET_NONE],
OperatingModes.QUICK_VETO: [None, PRESET_QUICK_VETO],
OperatingModes.QUICK_VETO: [HVACMode.HEAT, PRESET_QUICK_VETO],
QuickModes.SYSTEM_OFF: [HVACMode.OFF, PRESET_SYSTEM_OFF],
QuickModes.HOLIDAY: [HVACMode.OFF, PRESET_AWAY],
OperatingModes.MANUAL: [None, PRESET_HOME],
OperatingModes.MANUAL: [HVACMode.HEAT, PRESET_HOME],
}

_HA_MODE_TO_MULTIMATIC = {
Expand Down Expand Up @@ -329,16 +329,7 @@ def component(self) -> Room:
@property
def hvac_mode(self) -> HVACMode:
"""Get the hvac mode based on multimatic mode."""
hvac_mode = RoomClimate._MULTIMATIC_TO_HA[self.active_mode.current][0]
if not hvac_mode:
if self.active_mode.current in (
OperatingModes.MANUAL,
OperatingModes.QUICK_VETO,
):
if self.hvac_action == HVACAction.HEATING:
return HVACMode.HEAT
return HVACMode.OFF
return hvac_mode
return RoomClimate._MULTIMATIC_TO_HA[self.active_mode.current][0]

@property
def min_temp(self) -> float:
Expand Down Expand Up @@ -440,26 +431,7 @@ def component(self) -> Zone:
@property
def hvac_mode(self) -> HVACMode:
"""Get the hvac mode based on multimatic mode."""
current_mode = self.active_mode.current
hvac_mode = self._multimatic_mode()[current_mode][0]
if not hvac_mode:
if (
current_mode
in [
OperatingModes.DAY,
OperatingModes.NIGHT,
QuickModes.PARTY,
OperatingModes.QUICK_VETO,
]
and self.hvac_action == HVACAction.HEATING
):
return HVACMode.HEAT
if (
self.preset_mode == PRESET_COOLING_ON
and self.hvac_action == HVACAction.COOLING
):
return HVACMode.COOL
return hvac_mode if hvac_mode else HVACMode.OFF
return self._multimatic_mode()[self.active_mode.current][0]

@property
def min_temp(self) -> float:
Expand Down Expand Up @@ -505,11 +477,11 @@ class ZoneClimate(AbstractZoneClimate):

_MULTIMATIC_TO_HA: dict[Mode, list] = {
OperatingModes.AUTO: [HVACMode.AUTO, PRESET_COMFORT],
OperatingModes.DAY: [None, PRESET_HOME],
OperatingModes.NIGHT: [None, PRESET_SLEEP],
OperatingModes.DAY: [HVACMode.HEAT, PRESET_HOME],
OperatingModes.NIGHT: [HVACMode.OFF, PRESET_SLEEP],
OperatingModes.OFF: [HVACMode.OFF, PRESET_NONE],
OperatingModes.ON: [None, PRESET_COOLING_ON],
OperatingModes.QUICK_VETO: [None, PRESET_QUICK_VETO],
OperatingModes.ON: [HVACMode.COOL, PRESET_COOLING_ON],
OperatingModes.QUICK_VETO: [HVACMode.HEAT, PRESET_QUICK_VETO],
QuickModes.ONE_DAY_AT_HOME: [HVACMode.AUTO, PRESET_HOME],
QuickModes.PARTY: [HVACMode.OFF, PRESET_HOME],
QuickModes.VENTILATION_BOOST: [HVACMode.FAN_ONLY, PRESET_NONE],
Expand Down Expand Up @@ -547,11 +519,11 @@ class ZoneClimateSenso(AbstractZoneClimate):

_SENSO_TO_HA: dict[Mode, list] = {
OperatingModes.TIME_CONTROLLED: [HVACMode.AUTO, PRESET_COMFORT],
OperatingModes.DAY: [None, PRESET_HOME],
OperatingModes.NIGHT: [None, PRESET_SLEEP],
OperatingModes.DAY: [HVACMode.HEAT, PRESET_HOME],
OperatingModes.NIGHT: [HVACMode.OFF, PRESET_SLEEP],
OperatingModes.OFF: [HVACMode.OFF, PRESET_NONE],
OperatingModes.MANUAL: [None, PRESET_COOLING_ON],
OperatingModes.QUICK_VETO: [None, PRESET_QUICK_VETO],
OperatingModes.MANUAL: [HVACMode.COOL, PRESET_COOLING_ON],
OperatingModes.QUICK_VETO: [HVACMode.HEAT, PRESET_QUICK_VETO],
QuickModes.ONE_DAY_AT_HOME: [HVACMode.AUTO, PRESET_HOME],
QuickModes.PARTY: [HVACMode.OFF, PRESET_HOME],
QuickModes.VENTILATION_BOOST: [HVACMode.FAN_ONLY, PRESET_NONE],
Expand Down

0 comments on commit 0936444

Please sign in to comment.