From 00b1c2bb70a781241f8a68b9429e4e1dccf0c379 Mon Sep 17 00:00:00 2001 From: Matthias Alphart Date: Thu, 11 Nov 2021 19:39:57 +0100 Subject: [PATCH] Fix KNX climate entities hvac action without controller_mode (#59522) * fix hvac action for climate entities without controller_mode * Update homeassistant/components/knx/climate.py Co-authored-by: Marvin Wichmann Co-authored-by: Marvin Wichmann --- homeassistant/components/knx/climate.py | 8 ++++---- homeassistant/components/knx/const.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/knx/climate.py b/homeassistant/components/knx/climate.py index 2099270f036..6d3194731f1 100644 --- a/homeassistant/components/knx/climate.py +++ b/homeassistant/components/knx/climate.py @@ -268,10 +268,10 @@ class KNXClimate(KnxEntity, ClimateEntity): return CURRENT_HVAC_OFF if self._device.is_active is False: return CURRENT_HVAC_IDLE - if self._device.mode is not None and self._device.mode.supports_controller_mode: - return CURRENT_HVAC_ACTIONS.get( - self._device.mode.controller_mode.value, CURRENT_HVAC_IDLE - ) + if ( + self._device.mode is not None and self._device.mode.supports_controller_mode + ) or self._device.is_active: + return CURRENT_HVAC_ACTIONS.get(self.hvac_mode, CURRENT_HVAC_IDLE) return None async def async_set_hvac_mode(self, hvac_mode: str) -> None: diff --git a/homeassistant/components/knx/const.py b/homeassistant/components/knx/const.py index 1058f5abe07..f3468fc8dc2 100644 --- a/homeassistant/components/knx/const.py +++ b/homeassistant/components/knx/const.py @@ -79,11 +79,11 @@ CONTROLLER_MODES: Final = { } CURRENT_HVAC_ACTIONS: Final = { - "Heat": CURRENT_HVAC_HEAT, - "Cool": CURRENT_HVAC_COOL, - "Off": CURRENT_HVAC_OFF, - "Fan only": CURRENT_HVAC_FAN, - "Dry": CURRENT_HVAC_DRY, + HVAC_MODE_HEAT: CURRENT_HVAC_HEAT, + HVAC_MODE_COOL: CURRENT_HVAC_COOL, + HVAC_MODE_OFF: CURRENT_HVAC_OFF, + HVAC_MODE_FAN_ONLY: CURRENT_HVAC_FAN, + HVAC_MODE_DRY: CURRENT_HVAC_DRY, } PRESET_MODES: Final = {