Browse files

uses local time in milliseconds

  • Loading branch information...
1 parent 569e95b commit a13ad5d2524ea620c1d7397384f83d54089d96d2 @armin-bauer armin-bauer committed Feb 23, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 powerMonitor/gladosWatchasyncMeter.py
View
8 powerMonitor/gladosWatchasyncMeter.py
@@ -5,7 +5,7 @@
import time
-now = int(time.time())
+now = time.time()
channelNameForPulses = "Pulse"
channelNameForPowerReading = "Power"
@@ -17,13 +17,13 @@
def storeSensorValueInRedis(baseKeyData, channelName, timestamp, value):
"stores a sensor reading in redis"
- value = "[" + str(1000*timestamp) + "," + str(value) + "]"
+ value = "[" + str(int(1000*timestamp)) + "," + str(value) + "]"
redisConnection.rpush(baseKeyData + channelName, value)
return
def storePulseInRedis(baseKeyData, channelName, timestamp):
"stores a sensor reading in redis"
- value = "["+ str(1000*timestamp) +"]"
+ value = "["+ str(int(1000*timestamp)) +"]"
redisConnection.rpush(baseKeyData + channelName, value)
return
@@ -52,7 +52,7 @@ def storeSensorConfigurationInRedis(baseKeyConf, powerChannelName, pulseChannelN
measurementTime = int(data[7].strip("[]")) - int(data[0].strip("[]"));
# calculate the aprox power consumption
-pulsesPerHour = 3600 / averagePulseTime
+pulsesPerHour = 3600000 / averagePulseTime
powerConsumption = int((1000 * pulsesPerHour) / PULSES_PER_KWH);
# store the power consumption data.

0 comments on commit a13ad5d

Please sign in to comment.