mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Use fan mode when heat/cool is idle in homekit_controller (#128618)
This commit is contained in:
parent
067376cb3b
commit
b8f6fdeb2b
@ -8,6 +8,7 @@ from typing import Any, Final
|
|||||||
from aiohomekit.model.characteristics import (
|
from aiohomekit.model.characteristics import (
|
||||||
ActivationStateValues,
|
ActivationStateValues,
|
||||||
CharacteristicsTypes,
|
CharacteristicsTypes,
|
||||||
|
CurrentFanStateValues,
|
||||||
CurrentHeaterCoolerStateValues,
|
CurrentHeaterCoolerStateValues,
|
||||||
HeatingCoolingCurrentValues,
|
HeatingCoolingCurrentValues,
|
||||||
HeatingCoolingTargetValues,
|
HeatingCoolingTargetValues,
|
||||||
@ -484,6 +485,7 @@ class HomeKitClimateEntity(HomeKitBaseClimateEntity):
|
|||||||
CharacteristicsTypes.TEMPERATURE_TARGET,
|
CharacteristicsTypes.TEMPERATURE_TARGET,
|
||||||
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT,
|
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT,
|
||||||
CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET,
|
CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET,
|
||||||
|
CharacteristicsTypes.FAN_STATE_CURRENT,
|
||||||
]
|
]
|
||||||
|
|
||||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||||
@ -666,7 +668,19 @@ class HomeKitClimateEntity(HomeKitBaseClimateEntity):
|
|||||||
return HVACAction.IDLE
|
return HVACAction.IDLE
|
||||||
|
|
||||||
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_CURRENT)
|
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_CURRENT)
|
||||||
return CURRENT_MODE_HOMEKIT_TO_HASS.get(value)
|
current_hass_value = CURRENT_MODE_HOMEKIT_TO_HASS.get(value)
|
||||||
|
|
||||||
|
# If a device has a fan state (such as an Ecobee thermostat)
|
||||||
|
# show the Fan state when the device is otherwise idle.
|
||||||
|
if (
|
||||||
|
current_hass_value == HVACAction.IDLE
|
||||||
|
and self.service.has(CharacteristicsTypes.FAN_STATE_CURRENT)
|
||||||
|
and self.service.value(CharacteristicsTypes.FAN_STATE_CURRENT)
|
||||||
|
== CurrentFanStateValues.ACTIVE
|
||||||
|
):
|
||||||
|
return HVACAction.FAN
|
||||||
|
|
||||||
|
return current_hass_value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> HVACMode:
|
def hvac_mode(self) -> HVACMode:
|
||||||
|
@ -14,6 +14,6 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/homekit_controller",
|
"documentation": "https://www.home-assistant.io/integrations/homekit_controller",
|
||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["aiohomekit", "commentjson"],
|
"loggers": ["aiohomekit", "commentjson"],
|
||||||
"requirements": ["aiohomekit==3.2.3"],
|
"requirements": ["aiohomekit==3.2.5"],
|
||||||
"zeroconf": ["_hap._tcp.local.", "_hap._udp.local."]
|
"zeroconf": ["_hap._tcp.local.", "_hap._udp.local."]
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ aioharmony==0.2.10
|
|||||||
aiohasupervisor==0.2.0b0
|
aiohasupervisor==0.2.0b0
|
||||||
|
|
||||||
# homeassistant.components.homekit_controller
|
# homeassistant.components.homekit_controller
|
||||||
aiohomekit==3.2.3
|
aiohomekit==3.2.5
|
||||||
|
|
||||||
# homeassistant.components.hue
|
# homeassistant.components.hue
|
||||||
aiohue==4.7.3
|
aiohue==4.7.3
|
||||||
|
@ -247,7 +247,7 @@ aioharmony==0.2.10
|
|||||||
aiohasupervisor==0.2.0b0
|
aiohasupervisor==0.2.0b0
|
||||||
|
|
||||||
# homeassistant.components.homekit_controller
|
# homeassistant.components.homekit_controller
|
||||||
aiohomekit==3.2.3
|
aiohomekit==3.2.5
|
||||||
|
|
||||||
# homeassistant.components.hue
|
# homeassistant.components.hue
|
||||||
aiohue==4.7.3
|
aiohue==4.7.3
|
||||||
|
@ -6,6 +6,7 @@ from aiohomekit.model import Accessory
|
|||||||
from aiohomekit.model.characteristics import (
|
from aiohomekit.model.characteristics import (
|
||||||
ActivationStateValues,
|
ActivationStateValues,
|
||||||
CharacteristicsTypes,
|
CharacteristicsTypes,
|
||||||
|
CurrentFanStateValues,
|
||||||
CurrentHeaterCoolerStateValues,
|
CurrentHeaterCoolerStateValues,
|
||||||
SwingModeValues,
|
SwingModeValues,
|
||||||
TargetHeaterCoolerStateValues,
|
TargetHeaterCoolerStateValues,
|
||||||
@ -66,6 +67,9 @@ def create_thermostat_service(accessory: Accessory) -> None:
|
|||||||
char = service.add_char(CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT)
|
char = service.add_char(CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT)
|
||||||
char.value = 0
|
char.value = 0
|
||||||
|
|
||||||
|
char = service.add_char(CharacteristicsTypes.FAN_STATE_CURRENT)
|
||||||
|
char.value = 0
|
||||||
|
|
||||||
|
|
||||||
def create_thermostat_service_min_max(accessory: Accessory) -> None:
|
def create_thermostat_service_min_max(accessory: Accessory) -> None:
|
||||||
"""Define thermostat characteristics."""
|
"""Define thermostat characteristics."""
|
||||||
@ -648,6 +652,18 @@ async def test_hvac_mode_vs_hvac_action(
|
|||||||
assert state.state == "heat"
|
assert state.state == "heat"
|
||||||
assert state.attributes["hvac_action"] == "idle"
|
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
|
# Simulate that current temperature is below target temp
|
||||||
# Heating might be on and hvac_action currently 'heat'
|
# Heating might be on and hvac_action currently 'heat'
|
||||||
await helper.async_update(
|
await helper.async_update(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user