Skip to content

Commit

Permalink
Merge pull request #676 from onkelandy/sdp
Browse files Browse the repository at this point in the history
smartdeviceplugin: two fixes to make resend work
  • Loading branch information
Morg42 authored Aug 23, 2024
2 parents d49d56e + 9315ce8 commit cc0644a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/model/sdp/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"')
Expand Down
4 changes: 2 additions & 2 deletions lib/model/smartdeviceplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit cc0644a

Please sign in to comment.