use HeatingProgram type

This commit is contained in:
Christopher Fenner
2024-02-01 17:31:41 +01:00
parent f86f45fce1
commit 125495bfcb
2 changed files with 17 additions and 26 deletions

View File

@@ -40,7 +40,7 @@ from homeassistant.helpers import entity_platform
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN, VICARE_API, VICARE_DEVICE_CONFIG from .const import DOMAIN, VICARE_API, VICARE_DEVICE_CONFIG, HeatingProgram
from .entity import ViCareEntity from .entity import ViCareEntity
from .utils import get_burners, get_circuits, get_compressors from .utils import get_burners, get_circuits, get_compressors
@@ -57,15 +57,6 @@ VICARE_MODE_FORCEDREDUCED = "forcedReduced"
VICARE_MODE_FORCEDNORMAL = "forcedNormal" VICARE_MODE_FORCEDNORMAL = "forcedNormal"
VICARE_MODE_OFF = "standby" VICARE_MODE_OFF = "standby"
VICARE_PROGRAM_ACTIVE = "active"
VICARE_PROGRAM_COMFORT = "comfort"
VICARE_PROGRAM_ECO = "eco"
VICARE_PROGRAM_EXTERNAL = "external"
VICARE_PROGRAM_HOLIDAY = "holiday"
VICARE_PROGRAM_NORMAL = "normal"
VICARE_PROGRAM_REDUCED = "reduced"
VICARE_PROGRAM_STANDBY = "standby"
VICARE_HOLD_MODE_AWAY = "away" VICARE_HOLD_MODE_AWAY = "away"
VICARE_HOLD_MODE_HOME = "home" VICARE_HOLD_MODE_HOME = "home"
VICARE_HOLD_MODE_OFF = "off" VICARE_HOLD_MODE_OFF = "off"
@@ -84,17 +75,17 @@ VICARE_TO_HA_HVAC_HEATING: dict[str, HVACMode] = {
} }
VICARE_TO_HA_PRESET_HEATING = { VICARE_TO_HA_PRESET_HEATING = {
VICARE_PROGRAM_COMFORT: PRESET_COMFORT, HeatingProgram.COMFORT: PRESET_COMFORT,
VICARE_PROGRAM_ECO: PRESET_ECO, HeatingProgram.ECO: PRESET_ECO,
VICARE_PROGRAM_NORMAL: PRESET_HOME, HeatingProgram.NORMAL: PRESET_HOME,
VICARE_PROGRAM_REDUCED: PRESET_SLEEP, HeatingProgram.REDUCED: PRESET_SLEEP,
} }
HA_TO_VICARE_PRESET_HEATING = { HA_TO_VICARE_PRESET_HEATING = {
PRESET_COMFORT: VICARE_PROGRAM_COMFORT, PRESET_COMFORT: HeatingProgram.COMFORT,
PRESET_ECO: VICARE_PROGRAM_ECO, PRESET_ECO: HeatingProgram.ECO,
PRESET_HOME: VICARE_PROGRAM_NORMAL, PRESET_HOME: HeatingProgram.NORMAL,
PRESET_SLEEP: VICARE_PROGRAM_REDUCED, PRESET_SLEEP: HeatingProgram.REDUCED,
} }
@@ -318,9 +309,9 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
_LOGGER.debug("Current preset %s", self._current_program) _LOGGER.debug("Current preset %s", self._current_program)
if self._current_program and self._current_program not in [ if self._current_program and self._current_program not in [
VICARE_PROGRAM_NORMAL, HeatingProgram.NORMAL,
VICARE_PROGRAM_REDUCED, HeatingProgram.REDUCED,
VICARE_PROGRAM_STANDBY, HeatingProgram.STANDBY,
]: ]:
# We can't deactivate "normal", "reduced" or "standby" # We can't deactivate "normal", "reduced" or "standby"
_LOGGER.debug("deactivating %s", self._current_program) _LOGGER.debug("deactivating %s", self._current_program)
@@ -337,9 +328,9 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
_LOGGER.debug("Setting preset to %s / %s", preset_mode, target_program) _LOGGER.debug("Setting preset to %s / %s", preset_mode, target_program)
if target_program not in [ if target_program not in [
VICARE_PROGRAM_NORMAL, HeatingProgram.NORMAL,
VICARE_PROGRAM_REDUCED, HeatingProgram.REDUCED,
VICARE_PROGRAM_STANDBY, HeatingProgram.STANDBY,
]: ]:
# And we can't explicitly activate "normal", "reduced" or "standby", either # And we can't explicitly activate "normal", "reduced" or "standby", either
_LOGGER.debug("activating %s", target_program) _LOGGER.debug("activating %s", target_program)

View File

@@ -47,7 +47,7 @@ class HeatingProgram(enum.StrEnum):
# COMFORT_ECO = "comfortEnergySaving" # COMFORT_ECO = "comfortEnergySaving"
COMFORT_HEATING = "comfortHeating" COMFORT_HEATING = "comfortHeating"
# DHW_PRECEDENCE = "dhwPrecedence" # DHW_PRECEDENCE = "dhwPrecedence"
# ECO = "eco" ECO = "eco"
# EXTERNAL = "external" # EXTERNAL = "external"
# FIXED = "fixed" # FIXED = "fixed"
# FORCED = "forcedLastFromSchedule" # FORCED = "forcedLastFromSchedule"
@@ -65,7 +65,7 @@ class HeatingProgram(enum.StrEnum):
# REDUCED_COOLING_ECO = "reducedCoolingEnergySaving" # REDUCED_COOLING_ECO = "reducedCoolingEnergySaving"
# REDUCED_ECO = "reducedEnergySaving" # REDUCED_ECO = "reducedEnergySaving"
REDUCED_HEATING = "reducedHeating" REDUCED_HEATING = "reducedHeating"
# STANDBY = "standby" STANDBY = "standby"
# SUMMER_ECO = "summerEco" # SUMMER_ECO = "summerEco"