Fixes and version upgrade

This commit is contained in:
Patrick McDonagh
2016-03-31 10:41:57 -05:00
parent 084c2d8cdf
commit 660a28b608

View File

@@ -139,9 +139,9 @@ class start(threading.Thread, deviceBase):
self.daemon = True
self.forceSend = True
self.version = "2"
# self.device_address = "http://192.168.1.30/"
self.device_address = "http://localhost/"
self.version = "3"
self.device_address = "http://192.168.1.30"
# self.device_address = "http://localhost"
self.cardLoopTimer = 600
self.finished = threading.Event()
threading.Thread.start(self)
@@ -240,8 +240,8 @@ class start(threading.Thread, deviceBase):
runLoopStatus = "checkStoredValues"
self.checkStoredValues(self.forceSend)
runLoopStatus = "getDataLoggerStatus()"
self.getDataLoggerStatus()
# runLoopStatus = "getDataLoggerStatus()"
# self.getDataLoggerStatus()
if self.statusChanged:
runLoopStatus = "getLatestXCards"
@@ -282,7 +282,7 @@ class start(threading.Thread, deviceBase):
events = data["events"]
for event in events:
if int(event["id"]) not in self.eventIds:
timestamp = calendar.timegm(time.strptime(event["datetime"], '%Y-%m-%dT%H:%M:%S.%fZ'))
timestamp = event["datetime"]
# we have a new event
self.sendtodbJSON("events", json.dumps(event), timestamp)
self.eventIds.append(int(event["id"]))
@@ -453,10 +453,10 @@ class start(threading.Thread, deviceBase):
if s_p[i] is None:
continue
if s_p[i] != 0.0 and s_l[i] != 0.0:
newSc += "[" + str(s_p[i]) + ", " + str(s_l[i]) + "], "
newSc += "[" + str(round(s_p[i],3)) + ", " + str(round(s_l[i],3)) + "], "
except:
pass
newSc += "[" + str(s_p[0]) + ", " + str(s_l[0]) + "]"
newSc += "[" + str(round(s_p[0], 3)) + ", " + str(round(s_l[0], 3)) + "]"
newSc += "]"
for i in range(len(d_p)):
@@ -464,10 +464,10 @@ class start(threading.Thread, deviceBase):
if d_p[i] is None:
continue
if d_p[i] != 0.0 and d_l[i] != 0.0:
newDc += "[" + str(d_p[i]) + ", " + str(d_l[i]) + "], "
newDc += "[" + str(round(d_p[i], 3)) + ", " + str(round(d_l[i], 3)) + "], "
except:
pass
newDc += "[" + str(d_p[0]) + ", " + str(d_l[0]) + "]"
newDc += "[" + str(round(d_p[0], 3)) + ", " + str(round(d_l[0], 3)) + "]"
newDc += "]"
self.sendtodb("sc", newSc, card_timestamp)