Skip to content

Instantly share code, notes, and snippets.

@jmccrohan
Created May 6, 2011 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmccrohan/959591 to your computer and use it in GitHub Desktop.
Save jmccrohan/959591 to your computer and use it in GitHub Desktop.
CC128 pachube bash
#!/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