mirror of
https://github.com/skaringa/water-counter.git
synced 2024-11-21 17:04:25 +01:00
Pause detection fixed (again)
This commit is contained in:
parent
99c57b9c19
commit
a3a76dc7e1
@ -11,6 +11,7 @@ import os
|
||||
import csv
|
||||
import rrdtool as rrd
|
||||
from datetime import datetime
|
||||
import time
|
||||
from math import *
|
||||
|
||||
# Path to RRD with counter values
|
||||
@ -58,7 +59,7 @@ def detect_pauses(data):
|
||||
result = []
|
||||
(start_time, start_counter) = data[0]
|
||||
(end_time, end_counter) = data[-1]
|
||||
data.append((end_time + 1, end_counter + 1)) # ensure that counter increments
|
||||
data.append((time.time(), end_counter + 1)) # ensure that counter increments
|
||||
for (ts, counter) in data:
|
||||
if counter > start_counter:
|
||||
duration = ts - start_time
|
||||
|
Loading…
Reference in New Issue
Block a user