1 """Support for AtlanticDomesticHotWaterProductionMBLComponent."""
3 from typing
import Any, cast
5 from pyoverkiz.enums
import OverkizCommand, OverkizCommandParam, OverkizState
13 WaterHeaterEntityFeature,
18 from ..
import OverkizDataUpdateCoordinator
19 from ..entity
import OverkizEntity
23 """Representation of AtlanticDomesticHotWaterProductionMBLComponent (modbuslink)."""
25 _attr_temperature_unit = UnitOfTemperature.CELSIUS
26 _attr_supported_features = (
27 WaterHeaterEntityFeature.TARGET_TEMPERATURE
28 | WaterHeaterEntityFeature.OPERATION_MODE
29 | WaterHeaterEntityFeature.AWAY_MODE
30 | WaterHeaterEntityFeature.ON_OFF
32 _attr_operation_list = [
40 self, device_url: str, coordinator: OverkizDataUpdateCoordinator
43 super().
__init__(device_url, coordinator)
47 OverkizState.CORE_MAXIMAL_TEMPERATURE_MANUAL_MODE
53 OverkizState.CORE_MINIMAL_TEMPERATURE_MANUAL_MODE
59 """Return the current temperature."""
63 OverkizState.MODBUSLINK_MIDDLE_WATER_TEMPERATURE
69 """Return the temperature corresponding to the PRESET."""
72 self.
executorexecutor.select_state(OverkizState.CORE_WATER_TARGET_TEMPERATURE),
76 """Set new temperature."""
77 temperature = kwargs[ATTR_TEMPERATURE]
78 await self.
executorexecutor.async_execute_command(
79 OverkizCommand.SET_TARGET_DHW_TEMPERATURE, temperature
84 """Return true if boost mode is on."""
85 return self.
executorexecutor.select_state(OverkizState.MODBUSLINK_DHW_BOOST_MODE)
in (
86 OverkizCommandParam.ON,
87 OverkizCommandParam.PROG,
92 """Return true if eco mode is on."""
93 return self.
executorexecutor.select_state(OverkizState.MODBUSLINK_DHW_MODE)
in (
94 OverkizCommandParam.MANUAL_ECO_ACTIVE,
95 OverkizCommandParam.AUTO_MODE,
100 """Return true if away mode is on."""
101 return self.
executorexecutor.select_state(OverkizState.MODBUSLINK_DHW_ABSENCE_MODE)
in (
102 OverkizCommandParam.ON,
103 OverkizCommandParam.PROG,
108 """Return current operation."""
113 return STATE_PERFORMANCE
119 cast(str, self.
executorexecutor.select_state(OverkizState.MODBUSLINK_DHW_MODE))
120 == OverkizCommandParam.MANUAL_ECO_INACTIVE
125 return STATE_ELECTRIC
130 """Set new operation mode."""
131 if operation_mode == STATE_PERFORMANCE:
135 elif operation_mode == STATE_ECO:
140 await self.
executorexecutor.async_execute_command(
141 OverkizCommand.SET_DHW_MODE, OverkizCommandParam.AUTO_MODE
143 elif operation_mode == STATE_ELECTRIC:
148 await self.
executorexecutor.async_execute_command(
149 OverkizCommand.SET_DHW_MODE, OverkizCommandParam.MANUAL_ECO_INACTIVE
151 elif operation_mode == STATE_OFF:
155 """Turn away mode on.
157 This requires the start date and the end date to be also set, and those dates have to match the device datetime.
158 The API accepts setting dates in the format of the core:DateTimeState state for the DHW
159 {'day': 11, 'hour': 21, 'minute': 12, 'month': 7, 'second': 53, 'weekday': 3, 'year': 2024}
160 The dict is then passed as an actual device date, the away mode start date, and then as an end date,
161 but with the year incremented by 1, so the away mode is getting turned on for the next year.
162 The weekday number seems to have no effect so the calculation of the future date's weekday number is redundant,
163 but possible via homeassistant dt_util to form both start and end dates dictionaries from scratch
164 based on datetime.now() and datetime.timedelta into the future.
165 If you execute `setAbsenceStartDate`, `setAbsenceEndDate` and `setAbsenceMode`,
166 the API answers with "too many requests", as there's a polling update after each command execution,
167 and the device becomes unavailable until the API is available again.
168 With `refresh_afterwards=False` on the first commands, and `refresh_afterwards=True` only the last command,
169 the API is not choking and the transition is smooth without the unavailability state.
176 "weekday": now.weekday(),
178 "minute": now.minute,
179 "second": now.second,
181 await self.
executorexecutor.async_execute_command(
182 OverkizCommand.SET_DATE_TIME,
184 refresh_afterwards=
False,
186 await self.
executorexecutor.async_execute_command(
187 OverkizCommand.SET_ABSENCE_START_DATE, now_date, refresh_afterwards=
False
189 now_date[
"year"] = now_date[
"year"] + 1
190 await self.
executorexecutor.async_execute_command(
191 OverkizCommand.SET_ABSENCE_END_DATE, now_date, refresh_afterwards=
False
193 await self.
executorexecutor.async_execute_command(
194 OverkizCommand.SET_ABSENCE_MODE,
195 OverkizCommandParam.PROG,
196 refresh_afterwards=
False,
201 """Turn away mode off."""
202 await self.
executorexecutor.async_execute_command(
203 OverkizCommand.SET_ABSENCE_MODE, OverkizCommandParam.OFF
207 """Turn boost mode on."""
208 await self.
executorexecutor.async_execute_command(
209 OverkizCommand.SET_BOOST_MODE, OverkizCommandParam.ON
213 """Turn boost mode off."""
214 await self.
executorexecutor.async_execute_command(
215 OverkizCommand.SET_BOOST_MODE, OverkizCommandParam.OFF
str current_operation(self)
None async_turn_boost_mode_on(self)
bool is_eco_mode_on(self)
float current_temperature(self)
None async_set_operation_mode(self, str operation_mode)
bool is_boost_mode_on(self)
None __init__(self, str device_url, OverkizDataUpdateCoordinator coordinator)
None async_turn_away_mode_on(self)
None async_turn_away_mode_off(self)
float target_temperature(self)
None async_set_temperature(self, **Any kwargs)
bool is_away_mode_on(self)
None async_turn_boost_mode_off(self)
None async_turn_away_mode_on(self)
None async_turn_away_mode_off(self)
bool|None is_away_mode_on(self)