From 76513daa968e81724bac65c58caef17774e801f5 Mon Sep 17 00:00:00 2001 From: Onkel Andy Date: Mon, 8 Jul 2024 21:29:23 +0200 Subject: [PATCH] sdp: move command storing --- lib/model/smartdeviceplugin.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/model/smartdeviceplugin.py b/lib/model/smartdeviceplugin.py index 70e0907b1f..935576b279 100644 --- a/lib/model/smartdeviceplugin.py +++ b/lib/model/smartdeviceplugin.py @@ -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 @@ -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}')