|
|
@@ -0,0 +1,29 @@ |
|
|
|
#!/bin/sh - |
|
|
|
|
|
|
|
startday=$1 |
|
|
|
|
|
|
|
export TZ=America/Los_Angeles |
|
|
|
getutctime() { |
|
|
|
date -j -v 0H -v -1H -v 0M -v 0S -f %F "$1" +%s |
|
|
|
} |
|
|
|
|
|
|
|
getwhday() { |
|
|
|
grep -h "^production $(echo "$1" | head -c 7)" solar.*.log | sort | head -n 1 | python -c ' |
|
|
|
import json |
|
|
|
import sys |
|
|
|
l = sys.stdin.readline() |
|
|
|
data = json.loads(l.split(" ", 2)[2]) |
|
|
|
proddata = data["production"][1] |
|
|
|
condata = data["consumption"][0] |
|
|
|
print "\t%s\t%s\t%s\t%s\t%.03f\t%.03f" % (proddata["whToday"], proddata["whLastSevenDays"], float(proddata["whLastSevenDays"]) / 7, proddata["whLifetime"], condata["whToday"], condata["whLastSevenDays"])' |
|
|
|
} |
|
|
|
|
|
|
|
startepoch=$(getutctime "$startday") |
|
|
|
now=$(date +%s) |
|
|
|
|
|
|
|
printf "Date\t\twH\t\tlast 7\t\tavg last 7\tlifetime\tconsum today\tcon last 7\n" |
|
|
|
while [ "$startepoch" -le "$now" ]; do |
|
|
|
echo -n $(date -r "$startepoch" +%F) |
|
|
|
getwhday "$startepoch" |
|
|
|
startepoch=$(date -r "$startepoch" -v +1d +%s) |
|
|
|
done |