mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
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
@ -31,6 +31,7 @@ from aioairzone.const import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant.components.climate import (
|
from homeassistant.components.climate import (
|
||||||
|
ATTR_HVAC_MODE,
|
||||||
ATTR_TARGET_TEMP_HIGH,
|
ATTR_TARGET_TEMP_HIGH,
|
||||||
ATTR_TARGET_TEMP_LOW,
|
ATTR_TARGET_TEMP_LOW,
|
||||||
FAN_AUTO,
|
FAN_AUTO,
|
||||||
@ -222,6 +223,9 @@ class AirzoneClimate(AirzoneZoneEntity, ClimateEntity):
|
|||||||
params[API_HEAT_SET_POINT] = kwargs[ATTR_TARGET_TEMP_LOW]
|
params[API_HEAT_SET_POINT] = kwargs[ATTR_TARGET_TEMP_LOW]
|
||||||
await self._async_update_hvac_params(params)
|
await self._async_update_hvac_params(params)
|
||||||
|
|
||||||
|
if ATTR_HVAC_MODE in kwargs:
|
||||||
|
await self.async_set_hvac_mode(kwargs[ATTR_HVAC_MODE])
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _handle_coordinator_update(self) -> None:
|
def _handle_coordinator_update(self) -> None:
|
||||||
"""Update attributes when the coordinator updates."""
|
"""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_SYSTEM_ID: 1,
|
||||||
API_ZONE_ID: 5,
|
API_ZONE_ID: 5,
|
||||||
API_SET_POINT: 20.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,
|
SERVICE_SET_TEMPERATURE,
|
||||||
{
|
{
|
||||||
ATTR_ENTITY_ID: "climate.dorm_2",
|
ATTR_ENTITY_ID: "climate.dorm_2",
|
||||||
|
ATTR_HVAC_MODE: HVACMode.HEAT,
|
||||||
ATTR_TEMPERATURE: 20.5,
|
ATTR_TEMPERATURE: 20.5,
|
||||||
},
|
},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
state = hass.states.get("climate.dorm_2")
|
state = hass.states.get("climate.dorm_2")
|
||||||
|
assert state.state == HVACMode.HEAT
|
||||||
assert state.attributes.get(ATTR_TEMPERATURE) == 20.5
|
assert state.attributes.get(ATTR_TEMPERATURE) == 20.5
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user