Browse Source

use python3.8 for timestamp generation instead of date + shell script..

This gives more precision, and a better idea when the stamps came in..
main
John-Mark Gurney 3 years ago
parent
commit
2d565b77bb
2 changed files with 10 additions and 6 deletions
  1. +10
    -1
      streaming
  2. +0
    -5
      ts-util

+ 10
- 1
streaming View File

@@ -3,4 +3,13 @@
curl --no-buffer --digest -u installer:$(cat creds.inst.txt) http://$(read a b << EOF
$(cat creds.txt)
EOF
echo $a)/stream/meter 2>/dev/null | awk '$0 != "\r" { if ($1 == "data:") $1 = ""; print; fflush }' | ts-util > home.power.$(date +%Y%m%d%H%M).log
echo $a)/stream/meter 2>/dev/null | python3.8 -c 'import time; import sys
inp = sys.stdin
inp.reconfigure(line_buffering=True)
sys.stdout.reconfigure(line_buffering=True)
for i in inp:
i = i.strip()
if not i:
continue
i = i.split(maxsplit=1)[1]
print(time.time(), i)' > home.power.$(date +%Y%m%d%H%M).log

+ 0
- 5
ts-util View File

@@ -1,5 +0,0 @@
#!/bin/sh

while read l; do
echo $(TZ=UTC date +%Y-%m-%dT%H:%M:%SZ) $l
done

Loading…
Cancel
Save