/usr/local/bin/on_event_start:
LAST=$(cat /tmp/last_nsec)/root/wattvision:
# NS resolution counter:
NOW=$(awk 'NR == 3 { print $3 }' /proc/timer_list)
DELTA_MS=$(( (NOW - LAST) / 1000000 ))
echo $NOW > /tmp/last_nsec
echo $DELTA_MS > /tmp/last_ms_per_wh
POST_DATA1=(as before)
while true ; do
POST_DATA2="time=$(date -u +%Y-%m-%dT%H:%M:%S)"
POST_DATA3="ms_per_wh=$(cat /tmp/last_ms_per_wh)"
POST_DATA="${POST_DATA1}&${POST_DATA2}&${POST_DATA3}"
wget -q -O - --post-data="${POST_DATA}" http://www.wattvision.com/api
code=$?
echo $POST_DATA3, return code: $code
sleep 17
done
Next up - patch motion to allow events to be of a sub-second interval.
No comments:
Post a Comment