1
mirror of https://github.com/home-assistant/core synced 2024-09-28 03:04:04 +02:00

Add hvac_action support to melcloud (#103372)

Since actions are shared between water tank (if any) and climate device,
hvac action can be idle even when heat pump is active

Co-authored-by: jan iversen <jancasacondor@gmail.com>
This commit is contained in:
Florent Fourcot 2023-11-07 10:14:50 +01:00 committed by GitHub
parent 0a05a16fcb
commit 446de10aec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ from homeassistant.components.climate import (
DEFAULT_MIN_TEMP,
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
@ -60,6 +61,18 @@ ATW_ZONE_HVAC_MODE_LOOKUP = {
}
ATW_ZONE_HVAC_MODE_REVERSE_LOOKUP = {v: k for k, v in ATW_ZONE_HVAC_MODE_LOOKUP.items()}
ATW_ZONE_HVAC_ACTION_LOOKUP = {
atw.STATUS_IDLE: HVACAction.IDLE,
atw.STATUS_HEAT_ZONES: HVACAction.HEATING,
atw.STATUS_COOL: HVACAction.COOLING,
atw.STATUS_STANDBY: HVACAction.IDLE,
# Heating water tank, so the zone is idle
atw.STATUS_HEAT_WATER: HVACAction.IDLE,
atw.STATUS_LEGIONELLA: HVACAction.IDLE,
# Heat pump cannot heat in this mode, but will be ready soon
atw.STATUS_DEFROST: HVACAction.PREHEATING,
}
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
@ -351,6 +364,13 @@ class AtwDeviceZoneClimate(MelCloudClimate):
"""Return the list of available hvac operation modes."""
return [self.hvac_mode]
@property
def hvac_action(self) -> HVACAction | None:
"""Return the current running hvac operation."""
if not self._device.power:
return HVACAction.OFF
return ATW_ZONE_HVAC_ACTION_LOOKUP.get(self._device.status)
@property
def current_temperature(self) -> float | None:
"""Return the current temperature."""