Created
May 6, 2011 19:16
-
-
Save jmccrohan/959591 to your computer and use it in GitHub Desktop.
CC128 pachube bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# variables | |
pachube_api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
pachube_feed="12345" | |
stty -F /dev/ttyS0 57600 | |
touch /tmp/cc128 | |
while [ 1 ] | |
do | |
head /dev/ttyS0 -n150 | sed -n 's/.*\([^<]*\).*/\1/p' >> /tmp/cc128 | |
eval `awk '{total+=$0;n++}END{print "export WATTS="total/n}' /tmp/cc128` | |
curl --request PUT --header "X-PachubeApiKey: "$pachube_api_key --data $WATTS "http://www.pachube.com/api/"$pachube_feed".csv" | |
cat /dev/null > /tmp/cc128 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment