From 269c8f1d1477053f4aec683f2850cf34b5a7a012 Mon Sep 17 00:00:00 2001 From: David Bonnes Date: Mon, 21 Oct 2019 14:04:56 +0100 Subject: [PATCH] Add hvac_action to geniushub (#28056) * add hvac_action() to climate zones --- homeassistant/components/geniushub/climate.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/homeassistant/components/geniushub/climate.py b/homeassistant/components/geniushub/climate.py index 5acc25a36ee..9a19edd9f8b 100644 --- a/homeassistant/components/geniushub/climate.py +++ b/homeassistant/components/geniushub/climate.py @@ -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."""