Skip to content

Commit

Permalink
Add hvac_action support to melcloud
Browse files Browse the repository at this point in the history
Since actions are shared between water tank (if any) and climate device,
hvac action can be idle even when heat pump is active
  • Loading branch information
ffourcot committed Nov 4, 2023
1 parent 1517081 commit fb35ca8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions homeassistant/components/melcloud/climate.py
Expand Up @@ -20,6 +20,7 @@
DEFAULT_MIN_TEMP,
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
Expand Down Expand Up @@ -60,6 +61,18 @@
}
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
Expand Down Expand Up @@ -351,6 +364,13 @@ def hvac_modes(self) -> list[HVACMode]:
"""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."""
Expand Down

0 comments on commit fb35ca8

Please sign in to comment.