diff --git a/streaming b/streaming index 73f2b00..c4ce8b2 100644 --- a/streaming +++ b/streaming @@ -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 diff --git a/ts-util b/ts-util deleted file mode 100755 index 3f12f5d..0000000 --- a/ts-util +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -while read l; do - echo $(TZ=UTC date +%Y-%m-%dT%H:%M:%SZ) $l -done