Allow setting HVAC mode through set_temperature service in Airzone integration (#103185)
* airzone: climate: set_temperature: support ATTR_HVAC_MODE Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> * tests: airzone: set_temp: check HVAC mode Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> --------- Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
17acb04fb8
commit
77baea8cb7
2 changed files with 7 additions and 0 deletions
|
@ -31,6 +31,7 @@ from aioairzone.const import (
|
|||
)
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_HVAC_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH,
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
FAN_AUTO,
|
||||
|
@ -222,6 +223,9 @@ class AirzoneClimate(AirzoneZoneEntity, ClimateEntity):
|
|||
params[API_HEAT_SET_POINT] = kwargs[ATTR_TARGET_TEMP_LOW]
|
||||
await self._async_update_hvac_params(params)
|
||||
|
||||
if ATTR_HVAC_MODE in kwargs:
|
||||
await self.async_set_hvac_mode(kwargs[ATTR_HVAC_MODE])
|
||||
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
"""Update attributes when the coordinator updates."""
|
||||
|
|
|
@ -536,6 +536,7 @@ async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None:
|
|||
API_SYSTEM_ID: 1,
|
||||
API_ZONE_ID: 5,
|
||||
API_SET_POINT: 20.5,
|
||||
API_ON: 1,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -551,12 +552,14 @@ async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None:
|
|||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
ATTR_ENTITY_ID: "climate.dorm_2",
|
||||
ATTR_HVAC_MODE: HVACMode.HEAT,
|
||||
ATTR_TEMPERATURE: 20.5,
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
state = hass.states.get("climate.dorm_2")
|
||||
assert state.state == HVACMode.HEAT
|
||||
assert state.attributes.get(ATTR_TEMPERATURE) == 20.5
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue