mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +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:
|
async def async_turn_off(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch off."""
|
"""Turn the switch off."""
|
||||||
|
if not self._attr_is_on:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with self._client:
|
async with self._client:
|
||||||
await self.entity_description.off_action(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:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the switch on."""
|
"""Turn the switch on."""
|
||||||
|
if self._attr_is_on:
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with self._client:
|
async with self._client:
|
||||||
await self.entity_description.on_action(self._client)
|
await self.entity_description.on_action(self._client)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user