Allow setting HVAC mode through set_temperature service in Airzone Cloud integration (#103184)
* airzone_cloud: climate: set_temperature: support ATTR_HVAC_MODE Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> * tests: airzone_cloud: 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>pull/103482/head
parent
77baea8cb7
commit
ab6b3d5668
|
@ -32,6 +32,7 @@ from aioairzone_cloud.const import (
|
|||
)
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
ATTR_HVAC_MODE,
|
||||
ClimateEntity,
|
||||
ClimateEntityFeature,
|
||||
HVACAction,
|
||||
|
@ -204,6 +205,9 @@ class AirzoneDeviceClimate(AirzoneClimate):
|
|||
}
|
||||
await self._async_update_params(params)
|
||||
|
||||
if ATTR_HVAC_MODE in kwargs:
|
||||
await self.async_set_hvac_mode(kwargs[ATTR_HVAC_MODE])
|
||||
|
||||
|
||||
class AirzoneDeviceGroupClimate(AirzoneClimate):
|
||||
"""Define an Airzone Cloud DeviceGroup base class."""
|
||||
|
@ -238,6 +242,9 @@ class AirzoneDeviceGroupClimate(AirzoneClimate):
|
|||
}
|
||||
await self._async_update_params(params)
|
||||
|
||||
if ATTR_HVAC_MODE in kwargs:
|
||||
await self.async_set_hvac_mode(kwargs[ATTR_HVAC_MODE])
|
||||
|
||||
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||
"""Set hvac mode."""
|
||||
params: dict[str, Any] = {
|
||||
|
|
|
@ -453,12 +453,14 @@ async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None:
|
|||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
ATTR_ENTITY_ID: "climate.house",
|
||||
ATTR_HVAC_MODE: HVACMode.HEAT,
|
||||
ATTR_TEMPERATURE: 20.5,
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
state = hass.states.get("climate.house")
|
||||
assert state.state == HVACMode.HEAT
|
||||
assert state.attributes[ATTR_TEMPERATURE] == 20.5
|
||||
|
||||
# Zones
|
||||
|
@ -471,12 +473,14 @@ async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None:
|
|||
SERVICE_SET_TEMPERATURE,
|
||||
{
|
||||
ATTR_ENTITY_ID: "climate.salon",
|
||||
ATTR_HVAC_MODE: HVACMode.HEAT,
|
||||
ATTR_TEMPERATURE: 20.5,
|
||||
},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
state = hass.states.get("climate.salon")
|
||||
assert state.state == HVACMode.HEAT
|
||||
assert state.attributes[ATTR_TEMPERATURE] == 20.5
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue