log notification to google sheet using google form
trying to log historical temp data and in my quest i realized you can easily log events to a google sheet:
1) go to gdocs and create a Form
2) edit the form and add a "question" of type "text" for every dimension you want to log
3) view the live form and look at the source code and look for something like: form action="
https://docs.google.com/spreadsheet/formResponse?formkey=dFVLemRNVS1kNmpIR0JQWC01UmtXOFE6MQ&ifq" method="POST" id="ss-form"
4) grab the url for the action
5) look for something like: input type="text" name="entry.0.single" value="" class="ss-q-short" id="entry_0" for each question
6) append "&" + the name of the form element + "=" to the action url. like so:
https://docs.google.com/spreadsheet/formResponse?formkey=dFVLemRNVS1kNmpIR0JQWC01UmtXOFE6MQ&ifq&entry.0.single=7) cut and past that into a url shortener
8) create rule with http call and throw that url shorty in there
you could also multiple params/questions to the url before you shorten is like which twine it is or what the trigger/rule is
this didn't end up helping me on my quest but it works. i want a nice RESTful api i can poll to get data or have a time-based rule option and not a threshold-based rule type only
loving the hardware though!
Answers
see below:
wget -o log.txt --quiet -O temp.txt --keep-session-cookies --save-cookies cookies.txt --no-check-certificate --post-data="email=REPLACE_WITH_YOUR_LOGIN&password=REPLACE_WITH_YOUR_PASSWORD" https://twine.supermechanical.com/login
wget -o log.txt --quiet -O temp.txt --load-cookies cookies.txt --no-check-certificate https://twine.supermechanical.com/rt/REPLACE_WITH_YOUR_TWINE_ID?cached=1
DATE=`date`
TEMP=`cat temp.txt | awk -F"," '{print $7}' | awk -F"]" '{print $1}' | tr -d ' '`
echo "$DATE|$TEMP"
GSHEET='https://docs.google.com/spreadsheet/formResponse?formkey=REPLACE_WITH_YOUR_FORM_KEY&REPLACE_WITH_YOUR_FORM_ELEMENT_NAME='$TEMP
wget --quiet -O temp.txt $GSHEET