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)
This commit is contained in:
GaryOkie 2019-11-11 17:35:09 -06:00 committed by Martin Hjelmare
parent decab3e15b
commit a9a1c2b91d
2 changed files with 3 additions and 3 deletions

View file

@ -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,
}

View file

@ -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'