|
|
@@ -5,6 +5,9 @@
|
|
|
# To change the timing, update the DAYS_BACK variable below.
|
|
|
#
|
|
|
# Reads credentials from `keys.json`
|
|
|
+#
|
|
|
+# To ensure data is not read for a minute that has not yet ended,
|
|
|
+# this will read up to 2 minutes ago.
|
|
|
|
|
|
import pyemvue
|
|
|
import json
|
|
|
@@ -14,8 +17,8 @@ from pyemvue import PyEmVue
|
|
|
from pprint import pprint
|
|
|
from datetime import datetime, timezone, timedelta
|
|
|
|
|
|
-NOW = datetime.now(timezone.utc)
|
|
|
-DAYS_BACK = 7 # Number of days in the past to get per-minute data for.
|
|
|
+NOW = datetime.now(timezone.utc) - timedelta(minutes=2)
|
|
|
+DAYS_BACK = 14 # Number of days in the past to get per-minute data for.
|
|
|
MAX_HOURS = 12 # The maxinum number of hours that can be retrieved at once.
|
|
|
|
|
|
# Get & display minutely data for all devices.
|
|
|
@@ -52,7 +55,7 @@ def channelUsageOverTime(vue: PyEmVue, c):
|
|
|
|
|
|
# Jump to the next start time.
|
|
|
start_time = end_time
|
|
|
- end_time += timedelta(hours=MAX_HOURS)
|
|
|
+ end_time += timedelta(minutes=(MAX_HOURS*60))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
with open('keys.json') as f:
|