1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-08 09:38:58 +01:00

Add climate.is_hvac_mode condition (#166570)

This commit is contained in:
Erik Montnemery
2026-03-26 16:24:27 +01:00
committed by Franck Nijhof
parent 1b972d4adc
commit ee9d9781ee
5 changed files with 109 additions and 1 deletions
@@ -47,6 +47,7 @@ async def target_climates(hass: HomeAssistant) -> dict[str, list[str]]:
"climate.is_cooling",
"climate.is_drying",
"climate.is_heating",
"climate.is_hvac_mode",
"climate.target_humidity",
"climate.target_temperature",
],
@@ -83,6 +84,24 @@ async def test_climate_conditions_gated_by_labs_flag(
],
other_states=[HVACMode.OFF],
),
*(
param
for mode in HVACMode
for param in parametrize_condition_states_any(
condition="climate.is_hvac_mode",
condition_options={"hvac_mode": [mode]},
target_states=[mode],
other_states=[m for m in HVACMode if m != mode],
)
),
*parametrize_condition_states_any(
condition="climate.is_hvac_mode",
condition_options={"hvac_mode": [HVACMode.HEAT, HVACMode.COOL]},
target_states=[HVACMode.HEAT, HVACMode.COOL],
other_states=[
m for m in HVACMode if m not in (HVACMode.HEAT, HVACMode.COOL)
],
),
],
)
async def test_climate_state_condition_behavior_any(
@@ -133,6 +152,24 @@ async def test_climate_state_condition_behavior_any(
],
other_states=[HVACMode.OFF],
),
*(
param
for mode in HVACMode
for param in parametrize_condition_states_all(
condition="climate.is_hvac_mode",
condition_options={"hvac_mode": [mode]},
target_states=[mode],
other_states=[m for m in HVACMode if m != mode],
)
),
*parametrize_condition_states_all(
condition="climate.is_hvac_mode",
condition_options={"hvac_mode": [HVACMode.HEAT, HVACMode.COOL]},
target_states=[HVACMode.HEAT, HVACMode.COOL],
other_states=[
m for m in HVACMode if m not in (HVACMode.HEAT, HVACMode.COOL)
],
),
],
)
async def test_climate_state_condition_behavior_all(