Skip to content

Commit

Permalink
Allow EM heat on from any mode in Honeywell (#120750)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkmer authored Jun 30, 2024
1 parent 05ffd63 commit 419d89f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
13 changes: 6 additions & 7 deletions homeassistant/components/honeywell/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,12 @@ def __init__(

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."""
Expand Down
21 changes: 1 addition & 20 deletions tests/components/honeywell/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 419d89f

Please sign in to comment.