Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hvac_action support to melcloud #103372

Merged
merged 2 commits into from Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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