Add deconz current hvac operation to thermostate based on "state" (#59989)
* deconz - add current hvac operation to thermostate based on "state" * deconz - extend current hvac operation to thermostate based on "state" and "mode" * Add tests for current hvac action * Add boost mode as special case * format using Black * sort imports * Add test for device with mode none and state none * Update homeassistant/components/deconz/climate.py Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com> * Fix test_climate.py test_no_mode_no_state * Add test for boost mode Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
This commit is contained in:
parent
d7eb277bc8
commit
7a6897c757
2 changed files with 216 additions and 1 deletions
|
@ -24,6 +24,7 @@ from homeassistant.components.climate import (
|
|||
PRESET_ECO,
|
||||
ClimateEntity,
|
||||
ClimateEntityFeature,
|
||||
HVACAction,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
@ -172,6 +173,21 @@ class DeconzThermostat(DeconzDevice[Thermostat], ClimateEntity):
|
|||
mode=HVAC_MODE_TO_DECONZ[hvac_mode],
|
||||
)
|
||||
|
||||
@property
|
||||
def hvac_action(self) -> str | None:
|
||||
"""Return current hvac operation ie. heat, cool.
|
||||
|
||||
Preset 'BOOST' is interpreted as 'state_on'.
|
||||
"""
|
||||
if self._device.mode == ThermostatMode.OFF:
|
||||
return HVACAction.OFF
|
||||
|
||||
if self._device.state_on or self._device.preset == ThermostatPreset.BOOST:
|
||||
if self._device.mode == ThermostatMode.COOL:
|
||||
return HVACAction.COOLING
|
||||
return HVACAction.HEATING
|
||||
return HVACAction.IDLE
|
||||
|
||||
# Preset control
|
||||
|
||||
@property
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue