mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Allow EM heat on from any mode in Honeywell (#120750)
This commit is contained in:
parent
05ffd637f5
commit
419d89f863
@ -71,13 +71,12 @@ class HoneywellSwitch(SwitchEntity):
|
|||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch on if heat mode is enabled."""
|
"""Turn the switch on if heat mode is enabled."""
|
||||||
if self._device.system_mode == "heat":
|
try:
|
||||||
try:
|
await self._device.set_system_mode("emheat")
|
||||||
await self._device.set_system_mode("emheat")
|
except SomeComfortError as err:
|
||||||
except SomeComfortError as err:
|
raise HomeAssistantError(
|
||||||
raise HomeAssistantError(
|
translation_domain=DOMAIN, translation_key="switch_failed_on"
|
||||||
translation_domain=DOMAIN, translation_key="switch_failed_on"
|
) from err
|
||||||
) from err
|
|
||||||
|
|
||||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch off if on."""
|
"""Turn the switch off if on."""
|
||||||
|
@ -24,26 +24,6 @@ async def test_emheat_switch(
|
|||||||
|
|
||||||
await init_integration(hass, config_entry)
|
await init_integration(hass, config_entry)
|
||||||
entity_id = f"switch.{device.name}_emergency_heat"
|
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(
|
await hass.services.async_call(
|
||||||
SWITCH_DOMAIN,
|
SWITCH_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
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.assert_called_once_with("emheat")
|
||||||
|
|
||||||
device.set_system_mode.reset_mock()
|
device.set_system_mode.reset_mock()
|
||||||
|
|
||||||
device.system_mode = "emheat"
|
device.system_mode = "emheat"
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
SWITCH_DOMAIN,
|
SWITCH_DOMAIN,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user