Skip to content

Commit

Permalink
SDP: move resend relevant stuff outside of data_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Jun 1, 2024
1 parent 3f194b2 commit 7bf972e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions lib/model/smartdeviceplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,6 @@ def send_command(self, command, value=None, return_result=False, **kwargs):

try:
data_dict = self._commands.get_send_data(command, value, **kwargs)
data_dict['command'] = command
if value is not None and self._commands_read.get(command, None) is not None:
data_dict['returntype'] = type(value)
data_dict['returnvalue'] = value
data_dict['retry'] = kwargs.get('retry') or 0
except Exception as e:
self.logger.warning(f'command {command} with value {value} produced error on converting value, aborting. Error was: {e}')
return False
Expand All @@ -732,7 +727,7 @@ def send_command(self, command, value=None, return_result=False, **kwargs):
# if an error occurs on sending, an exception is thrown "below"
result = None
try:
result = self._send(data_dict)
result = self._send(data_dict, {'command': command, 'returntype': type(value), 'returnvalue': value, 'retry': kwargs.get('retry') or 0})
except (RuntimeError, OSError) as e: # Exception as e:
self.logger.debug(f'error on sending command {command}, error was {e}')
return False
Expand Down Expand Up @@ -960,7 +955,7 @@ def _do_before_send(self, command, value, kwargs):
return (True, True)
# return (False, True)

def _send(self, data_dict):
def _send(self, data_dict, resend_info=None):
"""
This method acts as a overwritable intermediate between the handling
logic of send_command() and the connection layer.
Expand Down Expand Up @@ -1690,7 +1685,6 @@ def create_struct_yaml(self):
return

self.yaml['item_structs'] = OrderedDict()

# this means the commands dict has 'ALL' and model names at the top level
# otherwise, the top level nodes are commands or sections
cmds_has_models = INDEX_GENERIC in top_level_entries
Expand Down

0 comments on commit 7bf972e

Please sign in to comment.