Skip to content

Commit

Permalink
sdp: move command storing
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Jul 8, 2024
1 parent 08ee3d8 commit 76513da
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/model/smartdeviceplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,10 +721,6 @@ def send_command(self, command, value=None, return_result=False, **kwargs):
self.logger.warning(f'command {command} with value {value} produced error on converting value, aborting. Error was: {e}')
return False

stored = self._connection.store_commands({'command': command, 'returntype': type(value), 'returnvalue': value, 'data_dict': data_dict})
if stored is True:
self.logger.debug(f'Command {command} stored for resend feature')

if data_dict['payload'] is None or data_dict['payload'] == '':
self.logger.warning(f'command {command} with value {value} yielded empty command payload, aborting')
return False
Expand All @@ -739,7 +735,9 @@ def send_command(self, command, value=None, return_result=False, **kwargs):
except (RuntimeError, OSError) as e: # Exception as e:
self.logger.debug(f'error on sending command {command}, error was {e}')
return False

stored = self._connection.store_commands({'command': command, 'returntype': type(value), 'returnvalue': value, 'data_dict': data_dict})
if stored is True:
self.logger.debug(f'Command {command} stored for resend feature')
if result:
by = kwargs.get('by')
self.logger.debug(f'command {command} received result {result} by {by}')
Expand Down

0 comments on commit 76513da

Please sign in to comment.