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:
parent
ceaf8f2402
commit
90575bc496
1 changed files with 12 additions and 0 deletions
|
@ -6,11 +6,13 @@ import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from iaqualink.device import AqualinkThermostat
|
from iaqualink.device import AqualinkThermostat
|
||||||
|
from iaqualink.systems.iaqua.device import AqualinkState
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
DOMAIN as CLIMATE_DOMAIN,
|
DOMAIN as CLIMATE_DOMAIN,
|
||||||
ClimateEntity,
|
ClimateEntity,
|
||||||
ClimateEntityFeature,
|
ClimateEntityFeature,
|
||||||
|
HVACAction,
|
||||||
HVACMode,
|
HVACMode,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
|
@ -82,6 +84,16 @@ class HassAqualinkThermostat(AqualinkEntity, ClimateEntity):
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning("Unknown operation mode: %s", hvac_mode)
|
_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
|
@property
|
||||||
def target_temperature(self) -> float:
|
def target_temperature(self) -> float:
|
||||||
"""Return the current target temperature."""
|
"""Return the current target temperature."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue