Remove turn_on and turn_off from SmartTub pump switches (#47184)

This commit is contained in:
Matt Zimmerman 2021-02-28 15:48:30 -08:00 committed by GitHub
parent b8c8fe0820
commit bab66a5cb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 29 deletions

View File

@ -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):

View File

@ -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()