Use fan mode when heat/cool is idle in homekit_controller (#128618)

This commit is contained in:
Joshua Shaffer
2024-10-24 08:25:40 +00:00
committed by GitHub
parent 067376cb3b
commit b8f6fdeb2b
5 changed files with 34 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ from aiohomekit.model import Accessory
from aiohomekit.model.characteristics import (
ActivationStateValues,
CharacteristicsTypes,
CurrentFanStateValues,
CurrentHeaterCoolerStateValues,
SwingModeValues,
TargetHeaterCoolerStateValues,
@@ -66,6 +67,9 @@ def create_thermostat_service(accessory: Accessory) -> None:
char = service.add_char(CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT)
char.value = 0
char = service.add_char(CharacteristicsTypes.FAN_STATE_CURRENT)
char.value = 0
def create_thermostat_service_min_max(accessory: Accessory) -> None:
"""Define thermostat characteristics."""
@@ -648,6 +652,18 @@ async def test_hvac_mode_vs_hvac_action(
assert state.state == "heat"
assert state.attributes["hvac_action"] == "idle"
# Simulate the fan running while the heat/cool is idle
await helper.async_update(
ServicesTypes.THERMOSTAT,
{
CharacteristicsTypes.FAN_STATE_CURRENT: CurrentFanStateValues.ACTIVE,
},
)
state = await helper.poll_and_get_state()
assert state.state == "heat"
assert state.attributes["hvac_action"] == "fan"
# Simulate that current temperature is below target temp
# Heating might be on and hvac_action currently 'heat'
await helper.async_update(