diff --git a/frappy/client/__init__.py b/frappy/client/__init__.py index dc2bbe5..99d8dca 100644 --- a/frappy/client/__init__.py +++ b/frappy/client/__init__.py @@ -753,10 +753,13 @@ class SecopClient(ProxyClient): data = datatype.import_value(data) return data, qualifiers - def execCommandFromString(self, module, command, formatted_argument): + def execCommandFromString(self, module, command, formatted_argument=''): """call command from string argument - return formatted data and qualifiers + return data as CacheItem which allows to get + - result.value # the python value + - result.formatted() # a string (incl. units) + - result.timestamp """ self.connect() datatype = self.modules[module]['commands'][command]['datatype'].argument @@ -766,11 +769,11 @@ class SecopClient(ProxyClient): if formatted_argument: raise WrongTypeError('command has no argument') argument = None + # pylint: disable=unsubscriptable-object data, qualifiers = self.request(COMMANDREQUEST, self.identifier[module, command], argument)[2] datatype = self.modules[module]['commands'][command]['datatype'].result - if datatype: - data = datatype.format_value(data) - return data, qualifiers + value = datatype.import_value(data) if datatype else None + return CacheItem(value, qualifiers.get('t'), None, datatype) def updateValue(self, module, param, value, timestamp, readerror): datatype = self.modules[module]['parameters'][param]['datatype']