Skip to content
Snippets Groups Projects
Commit 99819c55 authored by BRONES Romain's avatar BRONES Romain
Browse files

Fix GetNearest for scalar

* The return of the command is a tuple string, spearator ';'
* correctly convert timestamp and value
parent 4c8410df
No related branches found
No related tags found
No related merge requests found
......@@ -536,13 +536,13 @@ def _extract_scalar(attribute, method, date1, date2, db):
# Unpack return
try:
_date, _value = cmdreturn
_date, _value = cmdreturn.split(';')
except TypeError:
logger.error("Could not extract this chunk. Check the device extractor")
return None
# Fabricate return pandas.Series
d=pd.Series(index=[datetime.datetime.fromtimestamp(_date),], data=[_value,], name=attribute)
d=pd.Series(index=[datetime.datetime.fromtimestamp(int(_date)/1000),], data=[float(_value),], name=attribute)
return d
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment