1 """Support for ValveHeatingTemperatureInterface."""
3 from __future__
import annotations
5 from typing
import Any, cast
7 from pyoverkiz.enums
import OverkizCommand, OverkizCommandParam, OverkizState
22 from ..const
import DOMAIN
23 from ..coordinator
import OverkizDataUpdateCoordinator
24 from ..entity
import OverkizEntity
26 PRESET_MANUAL =
"manual"
27 PRESET_FROST_PROTECTION =
"frost_protection"
29 OVERKIZ_TO_HVAC_ACTION: dict[str, HVACAction] = {
30 OverkizCommandParam.OPEN: HVACAction.HEATING,
31 OverkizCommandParam.CLOSED: HVACAction.IDLE,
34 OVERKIZ_TO_PRESET_MODE: dict[str, str] = {
35 OverkizCommandParam.GEOFENCING_MODE: PRESET_NONE,
36 OverkizCommandParam.SUDDEN_DROP_MODE: PRESET_NONE,
37 OverkizCommandParam.AWAY: PRESET_AWAY,
38 OverkizCommandParam.COMFORT: PRESET_COMFORT,
39 OverkizCommandParam.ECO: PRESET_ECO,
40 OverkizCommandParam.FROSTPROTECTION: PRESET_FROST_PROTECTION,
41 OverkizCommandParam.MANUAL: PRESET_MANUAL,
43 PRESET_MODE_TO_OVERKIZ = {v: k
for k, v
in OVERKIZ_TO_PRESET_MODE.items()}
45 TEMPERATURE_SENSOR_DEVICE_INDEX = 2
49 """Representation of Valve Heating Temperature Interface device."""
51 _attr_hvac_mode = HVACMode.HEAT
52 _attr_hvac_modes = [HVACMode.HEAT]
53 _attr_preset_modes = [*PRESET_MODE_TO_OVERKIZ]
54 _attr_supported_features = (
55 ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TARGET_TEMPERATURE
57 _attr_temperature_unit = UnitOfTemperature.CELSIUS
58 _attr_translation_key = DOMAIN
59 _enable_turn_on_off_backwards_compatibility =
False
62 self, device_url: str, coordinator: OverkizDataUpdateCoordinator
65 super().
__init__(device_url, coordinator)
67 TEMPERATURE_SENSOR_DEVICE_INDEX
71 float, self.
executorexecutor.select_state(OverkizState.CORE_MIN_SETPOINT)
74 float, self.
executorexecutor.select_state(OverkizState.CORE_MAX_SETPOINT)
79 """Return the current running hvac operation."""
80 return OVERKIZ_TO_HVAC_ACTION[
81 cast(str, self.
executorexecutor.select_state(OverkizState.CORE_OPEN_CLOSED_VALVE))
86 """Return the temperature."""
88 float, self.
executorexecutor.select_state(OverkizState.CORE_TARGET_TEMPERATURE)
93 """Return the current temperature."""
95 temperature := self.
temperature_devicetemperature_device.states[OverkizState.CORE_TEMPERATURE]
97 return temperature.value_as_float
102 """Set new temperature."""
103 temperature = kwargs[ATTR_TEMPERATURE]
105 await self.
executorexecutor.async_execute_command(
106 OverkizCommand.SET_DEROGATION,
108 OverkizCommandParam.FURTHER_NOTICE,
112 """Set new target hvac mode."""
117 """Return the current preset mode, e.g., home, away, temp."""
118 return OVERKIZ_TO_PRESET_MODE[
120 str, self.
executorexecutor.select_state(OverkizState.IO_DEROGATION_HEATING_MODE)
125 """Set new preset mode."""
129 if preset_mode == PRESET_MANUAL:
131 await self.
executorexecutor.async_execute_command(
132 OverkizCommand.SET_DEROGATION,
134 OverkizCommandParam.FURTHER_NOTICE,
137 await self.
executorexecutor.async_execute_command(
138 OverkizCommand.SET_DEROGATION,
139 PRESET_MODE_TO_OVERKIZ[preset_mode],
140 OverkizCommandParam.FURTHER_NOTICE,
float|None current_temperature(self)
float|None current_temperature(self)
None async_set_preset_mode(self, str preset_mode)
None async_set_hvac_mode(self, HVACMode hvac_mode)
None __init__(self, str device_url, OverkizDataUpdateCoordinator coordinator)
float target_temperature(self)
HVACAction hvac_action(self)
None async_set_temperature(self, **Any kwargs)