From 42d2f30ab8d9a431661c0fbc31f17f737b8c4fca Mon Sep 17 00:00:00 2001
From: monte-monte <6649967+monte-monte@users.noreply.github.com>
Date: Thu, 11 Jul 2019 01:59:43 +0300
Subject: [PATCH] Complete OPERATION_MODES (#25069)

XKNX library has complete list of KNX controller modes, but current version of HA KNX climate plugin uses only two of them and one is named incorrectly ("Dehumidification" instead of "Dry"). https://github.com/XKNX/xknx/blob/master/xknx/knx/dpt_hvac_mode.py
I've added missing control modes, which has corresponding operation mode in HA. Tested this patch on my KNX IntesisBox which is used with Mitsubishi split AC, all modes were detected correctly and working as expected.
I've also corrected datapoint number in a comment, because it was pointing to a wrong one: http://www.sti.uniurb.it/romanell/Domotica_e_Edifici_Intelligenti/110504-Lez10a-KNX-Datapoint%20Types%20v1.5.00%20AS.pdf see page 94.
---
 homeassistant/components/knx/climate.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/homeassistant/components/knx/climate.py b/homeassistant/components/knx/climate.py
index 15dfc2d7f49..4b5998016e1 100644
--- a/homeassistant/components/knx/climate.py
+++ b/homeassistant/components/knx/climate.py
@@ -6,8 +6,8 @@ import voluptuous as vol
 from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
 from homeassistant.components.climate.const import (
     HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY, HVAC_MODE_HEAT, HVAC_MODE_OFF,
-    PRESET_ECO, PRESET_SLEEP, PRESET_AWAY, PRESET_COMFORT,
-    SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE)
+    HVAC_MODE_COOL, HVAC_MODE_AUTO, PRESET_ECO, PRESET_SLEEP, PRESET_AWAY,
+    PRESET_COMFORT, SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE)
 from homeassistant.const import ATTR_TEMPERATURE, CONF_NAME, TEMP_CELSIUS
 from homeassistant.core import callback
 import homeassistant.helpers.config_validation as cv
@@ -44,9 +44,13 @@ DEFAULT_SETPOINT_SHIFT_MAX = 6
 DEFAULT_SETPOINT_SHIFT_MIN = -6
 # Map KNX operation modes to HA modes. This list might not be full.
 OPERATION_MODES = {
-    # Map DPT 201.104 HVAC control modes
+    # Map DPT 201.105 HVAC control modes
+    "Auto": HVAC_MODE_AUTO,
+    "Heat": HVAC_MODE_HEAT,
+    "Cool": HVAC_MODE_COOL,
+    "Off": HVAC_MODE_OFF,
     "Fan only": HVAC_MODE_FAN_ONLY,
-    "Dehumidification": HVAC_MODE_DRY
+    "Dry": HVAC_MODE_DRY
 }
 
 OPERATION_MODES_INV = dict((