diff --git a/trait.py b/trait.py index 89e7be6..d87307f 100644 --- a/trait.py +++ b/trait.py @@ -199,7 +199,7 @@ def execute(self, command, params): url = DOMOTICZ_URL + '/json.htm?type=command¶m=switchscene&idx=' + self.state.id + '&switchcmd=' if params['on'] is True and state == 'Off': url += 'On' - elif params['on'] is False and state == 'On': + elif params['on'] is False and state != 'Off': url += 'Off' else: raise SmartHomeError(ERR_ALREADY_IN_STATE, @@ -210,7 +210,7 @@ def execute(self, command, params): url = DOMOTICZ_URL + '/json.htm?type=command¶m=switchlight&idx=' + self.state.id + '&switchcmd=' if params['on'] is True and state == 'Off': url += 'On' - elif params['on'] is False and state == 'On': + elif params['on'] is False and state != 'Off': url += 'Off' else: raise SmartHomeError(ERR_ALREADY_IN_STATE,