IFTTT and Twine (logging with Google Spreadsheets)
  • For all of you looking to add more functionality beyond SMS and email I recommend setting up IFTTT recipes. For instance, I have my magswitch logging every time my door opens to a google spreadsheet.
  • 21 Comments sorted by
  • You're right, David. You need to input a whole bunch of rules with Twine as it's set up now. Instead of all possible temperatures, I chose to set up rules for likely temperatures: email me when rising or falling through 62-76 degrees. That's thirty individual rules through the Twine interface and one rule on IFTTT to input that data into a Google spreadsheet.

    If you'd like a walk-through, which parts are sticking points? The Twine rules or IFTTT? Jud's example on IFTTT is almost exactly like my own, here: https://ifttt.com/recipes/67075
  • Sean, reading your last msg it makes me think about Twine's original description on Kickstarter: No programming needed! I'm just kidding, but it's clear that some users need a simpler approach to accessing Twine's data. (:
  • Thanks. I will take a look at these ideas. But first I have to get a Twine that actually communicates regularly. Right now my update frequency ranges up to 3 hours and down to 7 seconds.
  • another approach: ended up writing a shell script that logs in, grabs current temp, writes to a log and posts to a google sheet (need to grab form key and form element name from source of form submit page on google). i set up in cron to run every 10 mins and log through stdout to a file

    you get back good JSON from the supermechanical website (like: {"gs_version": "Oct 3 2012-11:35:08", "age": 10.875224113464355, "ts": 1357246592.0, "values": [["00004999f257830700", "1.1.4"], ["00004999f257830701", 2600], ["00004999f257830703", "bottom"], ["00004999f257830705", 2615144], ["00004999f257830706", 0], ["00004999f257830707", 0]], "last_poll": 1357245824.0, "rssi": 178} )

    see twine.sh 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


    TEMP=`cat temp.txt | awk -F"," '{print $7}' | awk -F"]" '{print $1}' | tr -d ' '`

    echo "$DATE|$TEMP"


    wget --quiet -O temp.txt $GSHEET
  • Can you explain further for those of us who have no idea what this means? Or is this a case of "if you have to ask, you can't do it"?
  • I made a reply on another post with the same answer but why aren't people using https://cosm.com/ to log their data?
  • I just checked out cosm.com but again I am not sure how to do it. Maybe this could be written up for the not-so-with-it.
  • David, I haven't checked out cosm.com, but IFTTT (ifttt.com) is a web service that receives input and responds with rules you set up. If This Then That. So, you set up a rule in Twine that says, for instance, email me when the temperature rises above 75. Make the subject line "75 ||| rising".

    In IFTTT, set up a rule that says when you receive emails from your twine, add its subject line as a new row in a Google Spreadsheet.
  • Ah. But then you'd still need a rule for every possible temperature and in both directions, if you want to use that as a temperature log. E.g. rises above 70, rises above 71, rises above 72...., falls below 72, falls below 71, falls below 70....
  • Here's an example IFTTT rule that takes action based on a label you assign to an inbound email to your gmail account from Twine: https://ifttt.com/recipes/54689. In this case it logs info from that email to a Google docs spreadsheet.
  • Like an idiot I just asked a similar question about monitoring the temp of my homebrew. Would like to save the values, but I guess I can just set up multiple rules since there is probably only a limited range of temp values (unless we go through a heat wave here in LA).
  • I got some sort of logging working with cosm, a shell script, and a cron job: https://cosm.com/feeds/87550

    The shell script grabs the same json used to render the Twine dashboard, gets the temperature from that, then posts it to cosm. Seems to work, but it's a hack (and I didn't feel like doing the math in the script to make not-really-hot temperatures :))

    (the script: http://hastebin.com/lilicavuhu.sh)
  • Brian,

    I was kludging some things together in a similar fashion I think. I couldn't get your script tho; not sure if I'm just blocked ATM due to some network settings as I'm on the road tonight. Can you let me know if the HB location is working, otherwise? I'd like to compare notes or share what I'm doing :)
  • Sean,
    I guess there was a short expiration on the hastebin link; this should stick around: https://gist.github.com/2ec052638855b3a3d6c3

    I'd like to do it the right way(tm) at some point, but it sounds like official logging might be coming in the future.
  • I was doing almost exactly the same thing, although I'm just dumping it into a mysql db locally. To speed things up as I prototyped, I was using python to poke around the data once I'd curl'd it down from the server. Once I dropped the output from curl into a file for quick handling, I looked thru the values with a 'cat file | python -mjson.tool' which made it easy to see the mappings (even tho they're not terribly complex as it is).
  • Using IFTTT to send data to a Google Spreadsheet has demonstrated how my Twine is gradually losing interest in reporting out: https://docs.google.com/spreadsheet/ccc?key=0Anl5PLxiLhwSdDBhaDFyZzBYSjBKRWhyblpHS0JmNmc

    There should be a row for every degree change between 62 and 76 degrees. I've already had to change the battery once. The network doesn't seem to be the problem, as I can log in and view my Twine's condition without a problem.

    Is there a central thread where this is being discussed? I've read about it as addenda to other issues a few times.
  • Brian,
    Thanks for the script. I set it to send only the first two characters to cosm and threw it into a cron job to update on a set interval. Seems to work really well.
  • I'm using Brian's script in a loop, polling every 10 seconds for temperature, etc. Every few minutes the Twine seems to forget to update the timestamp (ts). The time-since-last-update (age) seems to increment correctly, but the full date and time of the current temperature reading ends up in the past.

    Anybody else seeing this?
  • If you use IFTTT to add a row to Google spreadsheets is there a way to get IFTTT to delete or archive the email after the rule is run?  Or a way to get IFTTT to search archived messages instead of only messages in the gmail inbox?  My inbox is filling up with twine messages that I have to periodically clean out manually.
  • yes I reported months ago on the inconsistent performance of twine reporting simple temperature change. I cautioned users to not use twine in a critical sensing task.
  • Hi, the login proccess (first wget) seems not to work for the new twine.cc site... Any help, please?


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!