mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Fix HKC showing hvac_action as idle when fan is active and heat cool target is off (#142443)
* Fix HKC showing hvac_action as idle when fan is active and heat cool target is off fixes #142442 * comment relocation
This commit is contained in:
parent
43f93c74da
commit
8d82ef8e36
@ -659,13 +659,7 @@ class HomeKitClimateEntity(HomeKitBaseClimateEntity):
|
|||||||
# e.g. a thermostat is "heating" a room to 75 degrees Fahrenheit.
|
# e.g. a thermostat is "heating" a room to 75 degrees Fahrenheit.
|
||||||
# Can be 0 - 2 (Off, Heat, Cool)
|
# Can be 0 - 2 (Off, Heat, Cool)
|
||||||
|
|
||||||
# If the HVAC is switched off, it must be idle
|
|
||||||
# This works around a bug in some devices (like Eve radiator valves) that
|
|
||||||
# return they are heating when they are not.
|
|
||||||
target = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
|
target = self.service.value(CharacteristicsTypes.HEATING_COOLING_TARGET)
|
||||||
if target == HeatingCoolingTargetValues.OFF:
|
|
||||||
return HVACAction.IDLE
|
|
||||||
|
|
||||||
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_CURRENT)
|
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_CURRENT)
|
||||||
current_hass_value = CURRENT_MODE_HOMEKIT_TO_HASS.get(value)
|
current_hass_value = CURRENT_MODE_HOMEKIT_TO_HASS.get(value)
|
||||||
|
|
||||||
@ -679,6 +673,12 @@ class HomeKitClimateEntity(HomeKitBaseClimateEntity):
|
|||||||
):
|
):
|
||||||
return HVACAction.FAN
|
return HVACAction.FAN
|
||||||
|
|
||||||
|
# If the HVAC is switched off, it must be idle
|
||||||
|
# This works around a bug in some devices (like Eve radiator valves) that
|
||||||
|
# return they are heating when they are not.
|
||||||
|
if target == HeatingCoolingTargetValues.OFF:
|
||||||
|
return HVACAction.IDLE
|
||||||
|
|
||||||
return current_hass_value
|
return current_hass_value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
3436
tests/components/homekit_controller/fixtures/ecobee3_lite.json
Normal file
3436
tests/components/homekit_controller/fixtures/ecobee3_lite.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,8 @@ from aiohomekit.model.characteristics import (
|
|||||||
CharacteristicsTypes,
|
CharacteristicsTypes,
|
||||||
CurrentFanStateValues,
|
CurrentFanStateValues,
|
||||||
CurrentHeaterCoolerStateValues,
|
CurrentHeaterCoolerStateValues,
|
||||||
|
HeatingCoolingCurrentValues,
|
||||||
|
HeatingCoolingTargetValues,
|
||||||
SwingModeValues,
|
SwingModeValues,
|
||||||
TargetHeaterCoolerStateValues,
|
TargetHeaterCoolerStateValues,
|
||||||
)
|
)
|
||||||
@ -20,6 +22,7 @@ from homeassistant.components.climate import (
|
|||||||
SERVICE_SET_HVAC_MODE,
|
SERVICE_SET_HVAC_MODE,
|
||||||
SERVICE_SET_SWING_MODE,
|
SERVICE_SET_SWING_MODE,
|
||||||
SERVICE_SET_TEMPERATURE,
|
SERVICE_SET_TEMPERATURE,
|
||||||
|
HVACAction,
|
||||||
HVACMode,
|
HVACMode,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -662,7 +665,7 @@ async def test_hvac_mode_vs_hvac_action(
|
|||||||
|
|
||||||
state = await helper.poll_and_get_state()
|
state = await helper.poll_and_get_state()
|
||||||
assert state.state == "heat"
|
assert state.state == "heat"
|
||||||
assert state.attributes["hvac_action"] == "fan"
|
assert state.attributes["hvac_action"] == HVACAction.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'
|
||||||
@ -676,7 +679,23 @@ async def test_hvac_mode_vs_hvac_action(
|
|||||||
|
|
||||||
state = await helper.poll_and_get_state()
|
state = await helper.poll_and_get_state()
|
||||||
assert state.state == "heat"
|
assert state.state == "heat"
|
||||||
assert state.attributes["hvac_action"] == "heating"
|
assert state.attributes["hvac_action"] == HVACAction.HEATING
|
||||||
|
|
||||||
|
# If the fan is active, and the heating is off, the hvac_action should be 'fan'
|
||||||
|
# and not 'idle' or 'heating'
|
||||||
|
await helper.async_update(
|
||||||
|
ServicesTypes.THERMOSTAT,
|
||||||
|
{
|
||||||
|
CharacteristicsTypes.FAN_STATE_CURRENT: CurrentFanStateValues.ACTIVE,
|
||||||
|
CharacteristicsTypes.HEATING_COOLING_CURRENT: HeatingCoolingCurrentValues.IDLE,
|
||||||
|
CharacteristicsTypes.HEATING_COOLING_TARGET: HeatingCoolingTargetValues.OFF,
|
||||||
|
CharacteristicsTypes.FAN_STATE_CURRENT: CurrentFanStateValues.ACTIVE,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
state = await helper.poll_and_get_state()
|
||||||
|
assert state.state == HVACMode.OFF
|
||||||
|
assert state.attributes["hvac_action"] == HVACAction.FAN
|
||||||
|
|
||||||
|
|
||||||
async def test_hvac_mode_vs_hvac_action_current_mode_wrong(
|
async def test_hvac_mode_vs_hvac_action_current_mode_wrong(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user