mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Map pre-heating and defrosting hvac actions in homekit (#123907)
closes #123864
This commit is contained in:
parent
f7e017aa73
commit
17f0d9ce45
@ -150,6 +150,8 @@ HC_HASS_TO_HOMEKIT_ACTION = {
|
|||||||
HVACAction.COOLING: HC_HEAT_COOL_COOL,
|
HVACAction.COOLING: HC_HEAT_COOL_COOL,
|
||||||
HVACAction.DRYING: HC_HEAT_COOL_COOL,
|
HVACAction.DRYING: HC_HEAT_COOL_COOL,
|
||||||
HVACAction.FAN: HC_HEAT_COOL_COOL,
|
HVACAction.FAN: HC_HEAT_COOL_COOL,
|
||||||
|
HVACAction.PREHEATING: HC_HEAT_COOL_HEAT,
|
||||||
|
HVACAction.DEFROSTING: HC_HEAT_COOL_HEAT,
|
||||||
}
|
}
|
||||||
|
|
||||||
FAN_STATE_INACTIVE = 0
|
FAN_STATE_INACTIVE = 0
|
||||||
@ -623,8 +625,10 @@ class Thermostat(HomeAccessory):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Set current operation mode for supported thermostats
|
# Set current operation mode for supported thermostats
|
||||||
if hvac_action := attributes.get(ATTR_HVAC_ACTION):
|
if (hvac_action := attributes.get(ATTR_HVAC_ACTION)) and (
|
||||||
homekit_hvac_action = HC_HASS_TO_HOMEKIT_ACTION[hvac_action]
|
homekit_hvac_action := HC_HASS_TO_HOMEKIT_ACTION.get(hvac_action),
|
||||||
|
HC_HEAT_COOL_OFF,
|
||||||
|
):
|
||||||
self.char_current_heat_cool.set_value(homekit_hvac_action)
|
self.char_current_heat_cool.set_value(homekit_hvac_action)
|
||||||
|
|
||||||
# Update current temperature
|
# Update current temperature
|
||||||
|
@ -161,6 +161,40 @@ async def test_thermostat(hass: HomeAssistant, hk_driver, events: list[Event]) -
|
|||||||
assert acc.char_current_temp.value == 23.0
|
assert acc.char_current_temp.value == 23.0
|
||||||
assert acc.char_display_units.value == 0
|
assert acc.char_display_units.value == 0
|
||||||
|
|
||||||
|
hass.states.async_set(
|
||||||
|
entity_id,
|
||||||
|
HVACMode.HEAT,
|
||||||
|
{
|
||||||
|
**base_attrs,
|
||||||
|
ATTR_TEMPERATURE: 22.2,
|
||||||
|
ATTR_CURRENT_TEMPERATURE: 17.8,
|
||||||
|
ATTR_HVAC_ACTION: HVACAction.PREHEATING,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert acc.char_target_temp.value == 22.2
|
||||||
|
assert acc.char_current_heat_cool.value == 1
|
||||||
|
assert acc.char_target_heat_cool.value == 1
|
||||||
|
assert acc.char_current_temp.value == 17.8
|
||||||
|
assert acc.char_display_units.value == 0
|
||||||
|
|
||||||
|
hass.states.async_set(
|
||||||
|
entity_id,
|
||||||
|
HVACMode.HEAT,
|
||||||
|
{
|
||||||
|
**base_attrs,
|
||||||
|
ATTR_TEMPERATURE: 22.2,
|
||||||
|
ATTR_CURRENT_TEMPERATURE: 17.8,
|
||||||
|
ATTR_HVAC_ACTION: HVACAction.DEFROSTING,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
assert acc.char_target_temp.value == 22.2
|
||||||
|
assert acc.char_current_heat_cool.value == 1
|
||||||
|
assert acc.char_target_heat_cool.value == 1
|
||||||
|
assert acc.char_current_temp.value == 17.8
|
||||||
|
assert acc.char_display_units.value == 0
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entity_id,
|
entity_id,
|
||||||
HVACMode.FAN_ONLY,
|
HVACMode.FAN_ONLY,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user