mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Guard Guardian switches from redundant on/off calls (#78791)
This commit is contained in:
parent
691df5a394
commit
d591787077
@ -146,6 +146,9 @@ class ValveControllerSwitch(ValveControllerEntity, SwitchEntity):
|
||||
|
||||
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch off."""
|
||||
if not self._attr_is_on:
|
||||
return
|
||||
|
||||
try:
|
||||
async with self._client:
|
||||
await self.entity_description.off_action(self._client)
|
||||
@ -159,6 +162,9 @@ class ValveControllerSwitch(ValveControllerEntity, SwitchEntity):
|
||||
|
||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||
"""Turn the switch on."""
|
||||
if self._attr_is_on:
|
||||
return
|
||||
|
||||
try:
|
||||
async with self._client:
|
||||
await self.entity_description.on_action(self._client)
|
||||
|
Loading…
x
Reference in New Issue
Block a user