mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +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):
|
||||
""" Turn the device on. """
|
||||
if CommandSwitch._switch(self._command_on):
|
||||
if not self._command_state:
|
||||
if (CommandSwitch._switch(self._command_on) and
|
||||
not self._command_state):
|
||||
self._state = True
|
||||
self.update_ha_state()
|
||||
|
||||
def turn_off(self, **kwargs):
|
||||
""" Turn the device off. """
|
||||
if CommandSwitch._switch(self._command_off):
|
||||
if not self._command_state:
|
||||
if (CommandSwitch._switch(self._command_off) and
|
||||
not self._command_state):
|
||||
self._state = False
|
||||
self.update_ha_state()
|
||||
|
Loading…
x
Reference in New Issue
Block a user