diff --git a/lib/model/sdp/connection.py b/lib/model/sdp/connection.py index a32be2298f..8cb123120c 100644 --- a/lib/model/sdp/connection.py +++ b/lib/model/sdp/connection.py @@ -189,7 +189,7 @@ def connected(self): """ getter for self._is_connected """ return self._is_connected - def on_data_received(self, by, data): + def on_data_received(self, by, data, command=None): """ callback for on_data_received event """ if data: self.logger.debug(f'received raw data "{data}" from "{by}"') diff --git a/lib/model/smartdeviceplugin.py b/lib/model/smartdeviceplugin.py index c4690fc205..20f145a59b 100644 --- a/lib/model/smartdeviceplugin.py +++ b/lib/model/smartdeviceplugin.py @@ -765,7 +765,7 @@ def send_command(self, command, value=None, return_result=False, **kwargs): result = None reply_pattern = self._commands.get_commandlist(command).get(CMD_ATTR_REPLY_PATTERN) # replace custom patterns in reply_pattern by the current result - if custom_value: + if custom_value and reply_pattern: for index in (1, 2, 3): custom_replacement = kwargs['custom'].get(index) if custom_replacement is not None: @@ -789,7 +789,7 @@ def send_command(self, command, value=None, return_result=False, **kwargs): for r in reply_pattern: if '(' not in r and '{' not in r: return_list.append(r) - reply_pattern = return_list if return_list else None + reply_pattern = return_list if return_list else value resend_info = {'command': resend_command, 'returnvalue': reply_pattern, 'read_cmd': read_cmd} # if reply pattern does not expect a specific value, use value as expected reply else: