1 """Support for Hitachi DHW."""
3 from __future__
import annotations
7 from pyoverkiz.enums
import OverkizCommand, OverkizCommandParam, OverkizState
12 WaterHeaterEntityFeature,
22 from ..entity
import OverkizEntity
24 OVERKIZ_TO_OPERATION_MODE: dict[str, str] = {
25 OverkizCommandParam.STANDARD: STATE_ON,
26 OverkizCommandParam.HIGH_DEMAND: STATE_HIGH_DEMAND,
27 OverkizCommandParam.STOP: STATE_OFF,
30 OPERATION_MODE_TO_OVERKIZ = {v: k
for k, v
in OVERKIZ_TO_OPERATION_MODE.items()}
34 """Representation of Hitachi DHW."""
38 _attr_precision = PRECISION_WHOLE
40 _attr_temperature_unit = UnitOfTemperature.CELSIUS
41 _attr_supported_features = (
42 WaterHeaterEntityFeature.TARGET_TEMPERATURE
43 | WaterHeaterEntityFeature.OPERATION_MODE
45 _attr_operation_list = [*OPERATION_MODE_TO_OVERKIZ]
49 """Return the current temperature."""
50 current_temperature = self.
devicedevice.states[OverkizState.CORE_DHW_TEMPERATURE]
51 if current_temperature:
52 return current_temperature.value_as_float
57 """Return the temperature we try to reach."""
58 target_temperature = self.
devicedevice.states[
59 OverkizState.MODBUS_CONTROL_DHW_SETTING_TEMPERATURE
61 if target_temperature:
62 return target_temperature.value_as_float
66 """Set new target temperature."""
68 await self.
executorexecutor.async_execute_command(
69 OverkizCommand.SET_CONTROL_DHW_SETTING_TEMPERATURE,
70 int(kwargs[ATTR_TEMPERATURE]),
75 """Return current operation ie. eco, electric, performance, ..."""
76 modbus_control = self.
devicedevice.states[OverkizState.MODBUS_CONTROL_DHW]
77 if modbus_control
and modbus_control.value_as_str == OverkizCommandParam.STOP:
80 current_mode = self.
devicedevice.states[OverkizState.MODBUS_DHW_MODE]
81 if current_mode
and current_mode.value_as_str
in OVERKIZ_TO_OPERATION_MODE:
82 return OVERKIZ_TO_OPERATION_MODE[current_mode.value_as_str]
87 """Set new target operation mode."""
89 if operation_mode == OverkizCommandParam.OFF:
90 await self.
executorexecutor.async_execute_command(
91 OverkizCommand.SET_CONTROL_DHW, OverkizCommandParam.STOP
97 await self.
executorexecutor.async_execute_command(
98 OverkizCommand.SET_CONTROL_DHW, OverkizCommandParam.ON
102 await self.
executorexecutor.async_execute_command(
103 OverkizCommand.SET_DHW_MODE, OPERATION_MODE_TO_OVERKIZ[operation_mode]
None async_set_temperature(self, **Any kwargs)
None async_set_operation_mode(self, str operation_mode)
float|None target_temperature(self)
str|None current_operation(self)
float|None current_temperature(self)
str|None current_operation(self)