From a9a1c2b91dd461ab462a1a6b7af6d66a4c01748e Mon Sep 17 00:00:00 2001 From: GaryOkie <37629938+GaryOkie@users.noreply.github.com> Date: Mon, 11 Nov 2019 17:35:09 -0600 Subject: [PATCH] Update Homekit climate.py to remap current mode (#28625) * Update Homekit climate.py to remap current mode This update changes the mapping of Homekit's Current Mode Heating/Cooling State to show the HASS Hvac_action attribute as "idle" instead of "off" when the returned value is 0. * Update climate.py removed imported constant no longer being used (CURRENT_HVAC_OFF) * corrected update to climate.py trying again to remove unused constant. * Update test_climate.py * removed "change" comment The added comment describing the change was not needed and should not be included, as it will already be described via "git annotate" (per @jc2k) --- homeassistant/components/homekit_controller/climate.py | 4 ++-- tests/components/homekit_controller/test_climate.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/homekit_controller/climate.py b/homeassistant/components/homekit_controller/climate.py index 194a2b5a42e..1f9118ff838 100644 --- a/homeassistant/components/homekit_controller/climate.py +++ b/homeassistant/components/homekit_controller/climate.py @@ -13,7 +13,7 @@ from homeassistant.components.climate.const import ( HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF, - CURRENT_HVAC_OFF, + CURRENT_HVAC_IDLE, CURRENT_HVAC_HEAT, CURRENT_HVAC_COOL, SUPPORT_TARGET_TEMPERATURE, @@ -39,7 +39,7 @@ MODE_HASS_TO_HOMEKIT = {v: k for k, v in MODE_HOMEKIT_TO_HASS.items()} DEFAULT_VALID_MODES = list(MODE_HOMEKIT_TO_HASS) CURRENT_MODE_HOMEKIT_TO_HASS = { - 0: CURRENT_HVAC_OFF, + 0: CURRENT_HVAC_IDLE, 1: CURRENT_HVAC_HEAT, 2: CURRENT_HVAC_COOL, } diff --git a/tests/components/homekit_controller/test_climate.py b/tests/components/homekit_controller/test_climate.py index 72c2038f1fe..0d3544a6f55 100644 --- a/tests/components/homekit_controller/test_climate.py +++ b/tests/components/homekit_controller/test_climate.py @@ -213,7 +213,7 @@ async def test_hvac_mode_vs_hvac_action(hass, utcnow): state = await helper.poll_and_get_state() assert state.state == "heat" - assert state.attributes["hvac_action"] == "off" + assert state.attributes["hvac_action"] == "idle" # Simulate that current temperature is below target temp # Heating might be on and hvac_action currently 'heat'