Allow EM heat on from any mode in Honeywell (#120750)

pull/120827/head^2
mkmer 2024-06-30 09:30:52 -04:00 committed by Franck Nijhof
parent 38a30b343d
commit a7246400b3
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
2 changed files with 7 additions and 27 deletions

View File

@ -71,13 +71,12 @@ class HoneywellSwitch(SwitchEntity):
async def async_turn_on(self, **kwargs: Any) -> None:
"""Turn the switch on if heat mode is enabled."""
if self._device.system_mode == "heat":
try:
await self._device.set_system_mode("emheat")
except SomeComfortError as err:
raise HomeAssistantError(
translation_domain=DOMAIN, translation_key="switch_failed_on"
) from err
try:
await self._device.set_system_mode("emheat")
except SomeComfortError as err:
raise HomeAssistantError(
translation_domain=DOMAIN, translation_key="switch_failed_on"
) from err
async def async_turn_off(self, **kwargs: Any) -> None:
"""Turn the switch off if on."""

View File

@ -24,26 +24,6 @@ async def test_emheat_switch(
await init_integration(hass, config_entry)
entity_id = f"switch.{device.name}_emergency_heat"
await hass.services.async_call(
SWITCH_DOMAIN,
SERVICE_TURN_ON,
{ATTR_ENTITY_ID: entity_id},
blocking=True,
)
device.set_system_mode.assert_not_called()
device.set_system_mode.reset_mock()
await hass.services.async_call(
SWITCH_DOMAIN,
SERVICE_TURN_OFF,
{ATTR_ENTITY_ID: entity_id},
blocking=True,
)
device.set_system_mode.assert_not_called()
device.system_mode = "heat"
await hass.services.async_call(
SWITCH_DOMAIN,
SERVICE_TURN_ON,
@ -53,6 +33,7 @@ async def test_emheat_switch(
device.set_system_mode.assert_called_once_with("emheat")
device.set_system_mode.reset_mock()
device.system_mode = "emheat"
await hass.services.async_call(
SWITCH_DOMAIN,