Fix Eve Thermo always showing as heating in homekit_controller even when off (#80019)
This commit is contained in:
parent
2427d5e28c
commit
117c12d135
2 changed files with 29 additions and 0 deletions
|
@ -565,6 +565,14 @@ class HomeKitClimateEntity(HomeKitBaseClimateEntity):
|
|||
# This characteristic describes the current mode of a device,
|
||||
# e.g. a thermostat is "heating" a room to 75 degrees Fahrenheit.
|
||||
# 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)
|
||||
if target == HeatingCoolingTargetValues.OFF:
|
||||
return HVACAction.IDLE
|
||||
|
||||
value = self.service.value(CharacteristicsTypes.HEATING_COOLING_CURRENT)
|
||||
return CURRENT_MODE_HOMEKIT_TO_HASS.get(value)
|
||||
|
||||
|
|
|
@ -619,6 +619,27 @@ async def test_hvac_mode_vs_hvac_action(hass, utcnow):
|
|||
assert state.attributes["hvac_action"] == "heating"
|
||||
|
||||
|
||||
async def test_hvac_mode_vs_hvac_action_current_mode_wrong(hass, utcnow):
|
||||
"""Check that we cope with buggy HEATING_COOLING_CURRENT."""
|
||||
helper = await setup_test_component(hass, create_thermostat_service)
|
||||
|
||||
await helper.async_update(
|
||||
ServicesTypes.THERMOSTAT,
|
||||
{
|
||||
CharacteristicsTypes.TEMPERATURE_CURRENT: 22,
|
||||
CharacteristicsTypes.TEMPERATURE_TARGET: 21,
|
||||
CharacteristicsTypes.HEATING_COOLING_CURRENT: 1,
|
||||
CharacteristicsTypes.HEATING_COOLING_TARGET: 0,
|
||||
CharacteristicsTypes.RELATIVE_HUMIDITY_CURRENT: 50,
|
||||
CharacteristicsTypes.RELATIVE_HUMIDITY_TARGET: 45,
|
||||
},
|
||||
)
|
||||
|
||||
state = await helper.poll_and_get_state()
|
||||
assert state.state == "off"
|
||||
assert state.attributes["hvac_action"] == "idle"
|
||||
|
||||
|
||||
def create_heater_cooler_service(accessory):
|
||||
"""Define thermostat characteristics."""
|
||||
service = accessory.add_service(ServicesTypes.HEATER_COOLER)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue