mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
combine ifs
This commit is contained in:
parent
e9059a3ed9
commit
9c85702c87
@ -115,14 +115,14 @@ class CommandSwitch(SwitchDevice):
|
|||||||
|
|
||||||
def turn_on(self, **kwargs):
|
def turn_on(self, **kwargs):
|
||||||
""" Turn the device on. """
|
""" Turn the device on. """
|
||||||
if CommandSwitch._switch(self._command_on):
|
if (CommandSwitch._switch(self._command_on) and
|
||||||
if not self._command_state:
|
not self._command_state):
|
||||||
self._state = True
|
self._state = True
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
""" Turn the device off. """
|
""" Turn the device off. """
|
||||||
if CommandSwitch._switch(self._command_off):
|
if (CommandSwitch._switch(self._command_off) and
|
||||||
if not self._command_state:
|
not self._command_state):
|
||||||
self._state = False
|
self._state = False
|
||||||
self.update_ha_state()
|
self.update_ha_state()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user