Support setting hvac_mode and temp in same homekit_controller set_temperature service call (#52195)

* Support setting hvac_mode and temp in same set_temperature service call

* Update homeassistant/components/homekit_controller/climate.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Update homeassistant/components/homekit_controller/climate.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Jc2k 2021-06-29 10:14:28 +01:00 committed by GitHub
parent 040c88f982
commit 7de3e7d1dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 48 additions and 7 deletions

View file

@ -271,7 +271,6 @@ async def test_climate_cannot_set_thermostat_temp_range_in_wrong_mode(hass, utcn
SERVICE_SET_TEMPERATURE,
{
"entity_id": "climate.testdevice",
"hvac_mode": HVAC_MODE_HEAT_COOL,
"temperature": 22,
"target_temp_low": 20,
"target_temp_high": 24,
@ -370,6 +369,35 @@ async def test_climate_set_thermostat_temp_on_sspa_device(hass, utcnow):
)
assert helper.characteristics[TEMPERATURE_TARGET].value == 21
await hass.services.async_call(
DOMAIN,
SERVICE_SET_TEMPERATURE,
{
"entity_id": "climate.testdevice",
"temperature": 22,
},
blocking=True,
)
assert helper.characteristics[TEMPERATURE_TARGET].value == 22
async def test_climate_set_mode_via_temp(hass, utcnow):
"""Test setting temperature and mode at same tims."""
helper = await setup_test_component(hass, create_thermostat_single_set_point_auto)
await hass.services.async_call(
DOMAIN,
SERVICE_SET_TEMPERATURE,
{
"entity_id": "climate.testdevice",
"temperature": 21,
"hvac_mode": HVAC_MODE_HEAT,
},
blocking=True,
)
assert helper.characteristics[TEMPERATURE_TARGET].value == 21
assert helper.characteristics[HEATING_COOLING_TARGET].value == 1
await hass.services.async_call(
DOMAIN,
SERVICE_SET_TEMPERATURE,
@ -381,6 +409,7 @@ async def test_climate_set_thermostat_temp_on_sspa_device(hass, utcnow):
blocking=True,
)
assert helper.characteristics[TEMPERATURE_TARGET].value == 22
assert helper.characteristics[HEATING_COOLING_TARGET].value == 3
async def test_climate_change_thermostat_humidity(hass, utcnow):