Add hvac_action to geniushub (#28056)

* add hvac_action() to climate zones
This commit is contained in:
David Bonnes 2019-10-21 14:04:56 +01:00 committed by GitHub
parent ac467d0b3f
commit 269c8f1d14
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,9 @@ from typing import List, Optional
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
CURRENT_HVAC_HEAT,
CURRENT_HVAC_IDLE,
CURRENT_HVAC_OFF,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
PRESET_ACTIVITY,
@ -68,6 +71,17 @@ class GeniusClimateZone(GeniusZone, ClimateDevice):
"""Return the list of available hvac operation modes."""
return list(HA_HVAC_TO_GH)
@property
def hvac_action(self) -> Optional[str]:
"""Return the current running hvac operation if supported."""
if "_state" in self._zone.data: # only for v3 API
if not self._zone.data["_state"].get("bIsActive"):
return CURRENT_HVAC_OFF
if self._zone.data["_state"].get("bOutRequestHeat"):
return CURRENT_HVAC_HEAT
return CURRENT_HVAC_IDLE
return None
@property
def preset_mode(self) -> Optional[str]:
"""Return the current preset mode, e.g., home, away, temp."""