mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix vicare program presets (#66476)
This commit is contained in:
parent
707f112f51
commit
4522a5698c
@ -19,6 +19,7 @@ from homeassistant.components.climate.const import (
|
|||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
PRESET_COMFORT,
|
PRESET_COMFORT,
|
||||||
PRESET_ECO,
|
PRESET_ECO,
|
||||||
|
PRESET_NONE,
|
||||||
SUPPORT_PRESET_MODE,
|
SUPPORT_PRESET_MODE,
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
)
|
)
|
||||||
@ -87,11 +88,13 @@ HA_TO_VICARE_HVAC_HEATING = {
|
|||||||
VICARE_TO_HA_PRESET_HEATING = {
|
VICARE_TO_HA_PRESET_HEATING = {
|
||||||
VICARE_PROGRAM_COMFORT: PRESET_COMFORT,
|
VICARE_PROGRAM_COMFORT: PRESET_COMFORT,
|
||||||
VICARE_PROGRAM_ECO: PRESET_ECO,
|
VICARE_PROGRAM_ECO: PRESET_ECO,
|
||||||
|
VICARE_PROGRAM_NORMAL: PRESET_NONE,
|
||||||
}
|
}
|
||||||
|
|
||||||
HA_TO_VICARE_PRESET_HEATING = {
|
HA_TO_VICARE_PRESET_HEATING = {
|
||||||
PRESET_COMFORT: VICARE_PROGRAM_COMFORT,
|
PRESET_COMFORT: VICARE_PROGRAM_COMFORT,
|
||||||
PRESET_ECO: VICARE_PROGRAM_ECO,
|
PRESET_ECO: VICARE_PROGRAM_ECO,
|
||||||
|
PRESET_NONE: VICARE_PROGRAM_NORMAL,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -322,7 +325,7 @@ class ViCareClimate(ClimateEntity):
|
|||||||
@property
|
@property
|
||||||
def preset_modes(self):
|
def preset_modes(self):
|
||||||
"""Return the available preset mode."""
|
"""Return the available preset mode."""
|
||||||
return list(VICARE_TO_HA_PRESET_HEATING)
|
return list(HA_TO_VICARE_PRESET_HEATING)
|
||||||
|
|
||||||
def set_preset_mode(self, preset_mode):
|
def set_preset_mode(self, preset_mode):
|
||||||
"""Set new preset mode and deactivate any existing programs."""
|
"""Set new preset mode and deactivate any existing programs."""
|
||||||
@ -333,8 +336,12 @@ class ViCareClimate(ClimateEntity):
|
|||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER.debug("Setting preset to %s / %s", preset_mode, vicare_program)
|
_LOGGER.debug("Setting preset to %s / %s", preset_mode, vicare_program)
|
||||||
self._circuit.deactivateProgram(self._current_program)
|
if self._current_program != VICARE_PROGRAM_NORMAL:
|
||||||
self._circuit.activateProgram(vicare_program)
|
# We can't deactivate "normal"
|
||||||
|
self._circuit.deactivateProgram(self._current_program)
|
||||||
|
if vicare_program != VICARE_PROGRAM_NORMAL:
|
||||||
|
# And we can't explicitly activate normal, either
|
||||||
|
self._circuit.activateProgram(vicare_program)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def extra_state_attributes(self):
|
def extra_state_attributes(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user