From bab66a5cb968bcc7c6ef7787c9dc645885569429 Mon Sep 17 00:00:00 2001 From: Matt Zimmerman Date: Sun, 28 Feb 2021 15:48:30 -0800 Subject: [PATCH] Remove turn_on and turn_off from SmartTub pump switches (#47184) --- homeassistant/components/smarttub/switch.py | 14 ------------- tests/components/smarttub/test_switch.py | 22 +++++++-------------- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/homeassistant/components/smarttub/switch.py b/homeassistant/components/smarttub/switch.py index 7e4c83f6feb..736611e5411 100644 --- a/homeassistant/components/smarttub/switch.py +++ b/homeassistant/components/smarttub/switch.py @@ -61,20 +61,6 @@ class SmartTubPump(SmartTubEntity, SwitchEntity): """Return True if the pump is on.""" return self.pump.state != SpaPump.PumpState.OFF - async def async_turn_on(self, **kwargs) -> None: - """Turn the pump on.""" - - # the API only supports toggling - if not self.is_on: - await self.async_toggle() - - async def async_turn_off(self, **kwargs) -> None: - """Turn the pump off.""" - - # the API only supports toggling - if self.is_on: - await self.async_toggle() - async def async_toggle(self, **kwargs) -> None: """Toggle the pump on or off.""" async with async_timeout.timeout(API_TIMEOUT): diff --git a/tests/components/smarttub/test_switch.py b/tests/components/smarttub/test_switch.py index 8750bf79747..1ef84631196 100644 --- a/tests/components/smarttub/test_switch.py +++ b/tests/components/smarttub/test_switch.py @@ -18,21 +18,13 @@ async def test_pumps(spa, setup_entry, hass): assert state is not None if pump.state == SpaPump.PumpState.OFF: assert state.state == "off" - - await hass.services.async_call( - "switch", - "turn_on", - {"entity_id": entity_id}, - blocking=True, - ) - pump.toggle.assert_called() else: assert state.state == "on" - await hass.services.async_call( - "switch", - "turn_off", - {"entity_id": entity_id}, - blocking=True, - ) - pump.toggle.assert_called() + await hass.services.async_call( + "switch", + "toggle", + {"entity_id": entity_id}, + blocking=True, + ) + pump.toggle.assert_called()