1 """Support for Somfy Heating Temperature Interface."""
3 from __future__
import annotations
7 from pyoverkiz.enums
import OverkizCommand, OverkizCommandParam, OverkizState
21 from ..coordinator
import OverkizDataUpdateCoordinator
22 from ..entity
import OverkizEntity
24 OVERKIZ_TO_PRESET_MODES: dict[str, str] = {
25 OverkizCommandParam.SECURED: PRESET_AWAY,
26 OverkizCommandParam.ECO: PRESET_ECO,
27 OverkizCommandParam.COMFORT: PRESET_COMFORT,
28 OverkizCommandParam.FREE: PRESET_NONE,
31 PRESET_MODES_TO_OVERKIZ = {v: k
for k, v
in OVERKIZ_TO_PRESET_MODES.items()}
33 OVERKIZ_TO_HVAC_MODES: dict[str, HVACMode] = {
34 OverkizCommandParam.AUTO: HVACMode.AUTO,
35 OverkizCommandParam.MANU: HVACMode.HEAT_COOL,
38 HVAC_MODES_TO_OVERKIZ = {v: k
for k, v
in OVERKIZ_TO_HVAC_MODES.items()}
40 OVERKIZ_TO_HVAC_ACTION: dict[str, HVACAction] = {
41 OverkizCommandParam.COOLING: HVACAction.COOLING,
42 OverkizCommandParam.HEATING: HVACAction.HEATING,
45 MAP_PRESET_TEMPERATURES: dict[str, str] = {
46 PRESET_COMFORT: OverkizState.CORE_COMFORT_ROOM_TEMPERATURE,
47 PRESET_ECO: OverkizState.CORE_ECO_ROOM_TEMPERATURE,
48 PRESET_AWAY: OverkizState.CORE_SECURED_POSITION_TEMPERATURE,
51 SETPOINT_MODE_TO_OVERKIZ_COMMAND: dict[str, str] = {
52 OverkizCommandParam.COMFORT: OverkizCommand.SET_COMFORT_TEMPERATURE,
53 OverkizCommandParam.ECO: OverkizCommand.SET_ECO_TEMPERATURE,
54 OverkizCommandParam.SECURED: OverkizCommand.SET_SECURED_POSITION_TEMPERATURE,
57 TEMPERATURE_SENSOR_DEVICE_INDEX = 2
61 """Representation of Somfy Heating Temperature Interface.
63 The thermostat has 3 ways of working:
64 - Auto: Switch to eco/comfort temperature on a schedule (day/hour of the day)
65 - Manual comfort: The thermostat use the temperature of the comfort setting (19°C degree by default)
66 - Manual eco: The thermostat use the temperature of the eco setting (17°C by default)
67 - Freeze protection: The thermostat use the temperature of the freeze protection (7°C by default)
69 There's also the possibility to change the working mode, this can be used to change from a heated
70 floor to a cooling floor in the summer.
73 _attr_temperature_unit = UnitOfTemperature.CELSIUS
74 _attr_supported_features = (
75 ClimateEntityFeature.PRESET_MODE
76 | ClimateEntityFeature.TARGET_TEMPERATURE
77 | ClimateEntityFeature.TURN_OFF
78 | ClimateEntityFeature.TURN_ON
80 _attr_hvac_modes = [*HVAC_MODES_TO_OVERKIZ]
81 _attr_preset_modes = [*PRESET_MODES_TO_OVERKIZ]
85 _enable_turn_on_off_backwards_compatibility =
False
88 self, device_url: str, coordinator: OverkizDataUpdateCoordinator
91 super().
__init__(device_url, coordinator)
93 TEMPERATURE_SENSOR_DEVICE_INDEX
98 """Return hvac operation i.e. heat, cool mode."""
99 state = self.
devicedevice.states[OverkizState.CORE_ON_OFF]
100 if state
and state.value_as_str == OverkizCommandParam.OFF:
104 state := self.
devicedevice.states[
105 OverkizState.OVP_HEATING_TEMPERATURE_INTERFACE_ACTIVE_MODE
107 )
and state.value_as_str:
108 return OVERKIZ_TO_HVAC_MODES[state.value_as_str]
113 """Set new target hvac mode."""
114 await self.
executorexecutor.async_execute_command(
115 OverkizCommand.SET_ACTIVE_MODE, HVAC_MODES_TO_OVERKIZ[hvac_mode]
120 """Return the current preset mode, e.g., home, away, temp."""
122 state := self.
devicedevice.states[
123 OverkizState.OVP_HEATING_TEMPERATURE_INTERFACE_SETPOINT_MODE
125 )
and state.value_as_str:
126 return OVERKIZ_TO_PRESET_MODES[state.value_as_str]
130 """Set new preset mode."""
131 await self.
executorexecutor.async_execute_command(
132 OverkizCommand.SET_MANU_AND_SET_POINT_MODES,
133 PRESET_MODES_TO_OVERKIZ[preset_mode],
138 """Return the current running hvac operation if supported."""
140 current_operation := self.
devicedevice.states[
141 OverkizState.OVP_HEATING_TEMPERATURE_INTERFACE_OPERATING_MODE
143 )
and current_operation.value_as_str:
144 return OVERKIZ_TO_HVAC_ACTION[current_operation.value_as_str]
150 """Return the target temperature."""
159 if mode
not in MAP_PRESET_TEMPERATURES:
162 if state := self.
devicedevice.states[MAP_PRESET_TEMPERATURES[mode]]:
163 return state.value_as_float
168 """Return the current temperature."""
170 temperature := self.
temperature_devicetemperature_device.states[OverkizState.CORE_TEMPERATURE]
172 return temperature.value_as_float
176 """Set new temperature."""
177 temperature = kwargs[ATTR_TEMPERATURE]
180 mode := self.
devicedevice.states[
181 OverkizState.OVP_HEATING_TEMPERATURE_INTERFACE_SETPOINT_MODE
183 )
and mode.value_as_str:
184 await self.
executorexecutor.async_execute_command(
185 SETPOINT_MODE_TO_OVERKIZ_COMMAND[mode.value_as_str], temperature
str|None preset_mode(self)
None async_set_temperature(self, **Any kwargs)
float|None current_temperature(self)
None async_set_hvac_mode(self, HVACMode hvac_mode)
HVACAction|None hvac_action(self)
float|None target_temperature(self)
str|None preset_mode(self)
None __init__(self, str device_url, OverkizDataUpdateCoordinator coordinator)
None async_set_preset_mode(self, str preset_mode)