From 99819c55cd6dea3d6dca715988eaa6b0c2cea995 Mon Sep 17 00:00:00 2001
From: Romain Broucquart <romain.broucquart@synchrotron-soleil.fr>
Date: Mon, 7 Aug 2023 14:18:06 +0200
Subject: [PATCH] Fix GetNearest for scalar

* The return of the command is a tuple string, spearator ';'
* correctly convert timestamp and value
---
 ArchiveExtractor.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ArchiveExtractor.py b/ArchiveExtractor.py
index 43d24d3..cf26417 100755
--- a/ArchiveExtractor.py
+++ b/ArchiveExtractor.py
@@ -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
 
-- 
GitLab