1 """Platform for water_heater integration."""
3 from __future__
import annotations
7 from pymelcloud
import DEVICE_TYPE_ATW, AtwDevice
8 from pymelcloud.atw_device
import (
9 PROPERTY_OPERATION_MODE,
10 PROPERTY_TARGET_TANK_TEMPERATURE,
12 from pymelcloud.device
import PROPERTY_POWER
18 WaterHeaterEntityFeature,
25 from .
import DOMAIN, MelCloudDevice
26 from .const
import ATTR_STATUS
30 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
32 """Set up MelCloud device climate based on config_entry."""
33 mel_devices = hass.data[DOMAIN][entry.entry_id]
37 for mel_device
in mel_devices[DEVICE_TYPE_ATW]
44 """Air-to-Water water heater."""
46 _attr_supported_features = (
47 WaterHeaterEntityFeature.TARGET_TEMPERATURE
48 | WaterHeaterEntityFeature.ON_OFF
49 | WaterHeaterEntityFeature.OPERATION_MODE
51 _attr_has_entity_name =
True
54 def __init__(self, api: MelCloudDevice, device: AtwDevice) ->
None:
55 """Initialize water heater device."""
62 """Update state from MELCloud."""
66 """Turn the entity on."""
67 await self.
_device_device.set({PROPERTY_POWER:
True})
70 """Turn the entity off."""
71 await self.
_device_device.set({PROPERTY_POWER:
False})
75 """Return the optional state attributes with device specific additions."""
76 return {ATTR_STATUS: self.
_device_device.status}
80 """Return the unit of measurement used by the platform."""
81 return UnitOfTemperature.CELSIUS
85 """Return current operation as reported by pymelcloud."""
86 return self.
_device_device.operation_mode
90 """Return the list of available operation modes as reported by pymelcloud."""
91 return self.
_device_device.operation_modes
95 """Return the current temperature."""
96 return self.
_device_device.tank_temperature
100 """Return the temperature we try to reach."""
101 return self.
_device_device.target_tank_temperature
104 """Set new target temperature."""
107 PROPERTY_TARGET_TANK_TEMPERATURE: kwargs.get(
114 """Set new target operation mode."""
115 await self.
_device_device.set({PROPERTY_OPERATION_MODE: operation_mode})
119 """Return the minimum temperature."""
120 return self.
_device_device.target_tank_temperature_min
or DEFAULT_MIN_TEMP
124 """Return the maximum temperature."""
125 return self.
_device_device.target_tank_temperature_max
or DEFAULT_MAX_TEMP
float|None target_temperature(self)
list[str] operation_list(self)
None async_set_temperature(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None async_set_operation_mode(self, str operation_mode)
str|None current_operation(self)
dict[str, Any]|None extra_state_attributes(self)
None __init__(self, MelCloudDevice api, AtwDevice device)
None async_turn_on(self, **Any kwargs)
float|None current_temperature(self)
str temperature_unit(self)
float|None target_temperature(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)