mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
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>
This commit is contained in:
parent
77baea8cb7
commit
ab6b3d5668
@ -32,6 +32,7 @@ from aioairzone_cloud.const import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
|
ATTR_HVAC_MODE,
|
||||||
ClimateEntity,
|
ClimateEntity,
|
||||||
ClimateEntityFeature,
|
ClimateEntityFeature,
|
||||||
HVACAction,
|
HVACAction,
|
||||||
@ -204,6 +205,9 @@ class AirzoneDeviceClimate(AirzoneClimate):
|
|||||||
}
|
}
|
||||||
await self._async_update_params(params)
|
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):
|
class AirzoneDeviceGroupClimate(AirzoneClimate):
|
||||||
"""Define an Airzone Cloud DeviceGroup base class."""
|
"""Define an Airzone Cloud DeviceGroup base class."""
|
||||||
@ -238,6 +242,9 @@ class AirzoneDeviceGroupClimate(AirzoneClimate):
|
|||||||
}
|
}
|
||||||
await self._async_update_params(params)
|
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:
|
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||||
"""Set hvac mode."""
|
"""Set hvac mode."""
|
||||||
params: dict[str, Any] = {
|
params: dict[str, Any] = {
|
||||||
|
@ -453,12 +453,14 @@ async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None:
|
|||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
{
|
{
|
||||||
ATTR_ENTITY_ID: "climate.house",
|
ATTR_ENTITY_ID: "climate.house",
|
||||||
|
ATTR_HVAC_MODE: HVACMode.HEAT,
|
||||||
ATTR_TEMPERATURE: 20.5,
|
ATTR_TEMPERATURE: 20.5,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get("climate.house")
|
state = hass.states.get("climate.house")
|
||||||
|
assert state.state == HVACMode.HEAT
|
||||||
assert state.attributes[ATTR_TEMPERATURE] == 20.5
|
assert state.attributes[ATTR_TEMPERATURE] == 20.5
|
||||||
|
|
||||||
# Zones
|
# Zones
|
||||||
@ -471,12 +473,14 @@ async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None:
|
|||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
{
|
{
|
||||||
ATTR_ENTITY_ID: "climate.salon",
|
ATTR_ENTITY_ID: "climate.salon",
|
||||||
|
ATTR_HVAC_MODE: HVACMode.HEAT,
|
||||||
ATTR_TEMPERATURE: 20.5,
|
ATTR_TEMPERATURE: 20.5,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get("climate.salon")
|
state = hass.states.get("climate.salon")
|
||||||
|
assert state.state == HVACMode.HEAT
|
||||||
assert state.attributes[ATTR_TEMPERATURE] == 20.5
|
assert state.attributes[ATTR_TEMPERATURE] == 20.5
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user