Add hvac_action attribute to iAqualink Thermostat climate entities (#107803)

* Update climate.py

* Reorder if/else statements per @dcmeglio's suggestion

* Don't infer state, actually read it from the underlying device

* HVACAction has a HEATING state, not ON

* Update homeassistant/components/iaqualink/climate.py

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
Marcin Wielgoszewski 2024-04-18 09:37:11 -04:00 committed by GitHub
parent ceaf8f2402
commit 90575bc496
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,11 +6,13 @@ import logging
from typing import Any
from iaqualink.device import AqualinkThermostat
from iaqualink.systems.iaqua.device import AqualinkState
from homeassistant.components.climate import (
DOMAIN as CLIMATE_DOMAIN,
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.config_entries import ConfigEntry
@ -82,6 +84,16 @@ class HassAqualinkThermostat(AqualinkEntity, ClimateEntity):
else:
_LOGGER.warning("Unknown operation mode: %s", hvac_mode)
@property
def hvac_action(self) -> HVACAction:
"""Return the current HVAC action."""
state = AqualinkState(self.dev._heater.state)
if state == AqualinkState.ON:
return HVACAction.HEATING
if state == AqualinkState.ENABLED:
return HVACAction.IDLE
return HVACAction.OFF
@property
def target_temperature(self) -> float:
"""Return the current target temperature."""