mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Remove turn_on and turn_off from SmartTub pump switches (#47184)
This commit is contained in:
parent
b8c8fe0820
commit
bab66a5cb9
@ -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):
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user