The Twine forums are now archived. If you need help, please visit


We talked briefly last year about an API. My company develops the Indigo home automation software for the Mac. We would love to see an Indigo plugin for the Twine. We would prefer some way to directly catch status updates whenever something changes on the Twine. Is that going to be possible?

Best Answer

  • 51 Comments sorted by Votes Date Added
  • Oh, right, the Q/A format. Short answer: yes, possible, but how we'll prioritize a thoughtful API is another question. In the near term, we will listen to what people want. I understand that if you want to simply collect data regardless of triggering events, we don't have a good solution at the moment.


  • Yup, a robust API is essential if these things are going to go anywhere. Handcuffing developers to the Supermechanical website won't grow anything. We need direct access to and interaction with our Twines. Until then, they're sort of proof-of-concept toys.
  • 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 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"

    wget -o log.txt --quiet -O temp.txt --load-cookies cookies.txt --no-check-certificate


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

    echo "$DATE|$TEMP"


    wget --quiet -O temp.txt $GSHEET
  • I'd love to just graph my Twine's temperature over time. An API to query it (polling), or alternatively a push API that sends an HTTP request when a change happens (interrupt style) would be great.
  • +1 for an API that I could access and tinker with. Like Kit and Derek (above), I'm a Rails developer who was (a little) disappointed to learn that my interaction with Twine is limited to the rules and HTTP get requests from the official Twine app.

    I understand that shipping thousands of Twines is the priority right now, but empowering the developer community to build software/apps that run on top of the the Twine platform has to be a close second, no? My guess is that the really interesting and innovative (read: marketable) Twine use-cases will come from folks who have access to a robust API.
  • This is indeed very disappointing. I have been waiting for the Twine for weeks and was hoping to install a service on my computer that polled the device in regular intervals for current temp and humidity. Right now I can only define a rule and the humidity is only digital yes/no. I never saw it anywhere that the humidity sensor was non-analog.
  • I can only agree with Holger. Simple logging was one thing i certainly expected
  • Several of you have come up with very clever workarounds to fill in the current holes. (If you actually do a piezo sensor+drinking bird, video please!) I can't respond to every thread (you'd rather have me working on the features, right?), but we listen. David and I have a long to-do list.

    We don't make a humidity sensor at this point, but the moisture sensor detects the presence of liquid, yes. Technically, it's tuned for liquid conductivity but even oily skin will work. We've used it as a punch clock.
  • The URL listed above to pull the data down will no longer work.. To get the JSON data, you need to use:

    This just changed. The old method above will give you an error.
  • had the same issue my data logging stopped between 19:30 and 19:45 PST last night (March 25) - cause the url format changed exactly as Stacy indicates.  "rt" is now after the twine id as opposed to before.
  • they changed the url formulations.  i also started logging 3 twines for different experiments for interactions between different zones ( results: - note the lack of data for it was busted :).  here's the updated shell script - i run it every 30 mins now:

    wget -o log.txt --quiet -O temp.txt --keep-session-cookies --save-cookies cookies.txt --no-check-certificate --post-

    wget -o log.txt --quiet -O temp.txt --load-cookies cookies.txt --no-check-certificate


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


    wget -o log.txt --quiet -O temp.txt --load-cookies cookies.txt --no-check-certificate

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


    wget -o log.txt --quiet -O temp.txt --load-cookies cookies.txt --no-check-certificate

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


    echo "$DATE|$TEMP|$TEMP2|$TEMP3"


    wget --quiet -O temp.txt $GSHEET
  • After playing around with mine for a bit today, it doesn't look possible given the current tools to get the temp/direction into Indigo whenever it changes. At least, not without creating a rule for every possible temperature. I suppose it would be possible for orientation changes since there are only a fixed number of those.

    We'd really be interested in working with you guys to enable a better integration with home automation software. The regular 1 minute update interval that the twine website gets would be awesome if we could configure the twine to update another URL with values that frequently. Just thinking out-loud here.
  • Jay, we've got it on our to-do list - after shipping a couple thousand boxes, of course! You can currently output the temperature in a HTTP action.
  • Yep, and that's great, but limited to only when one of the rules fires. The rule definitions don't allow you to fire whenever a temperature changes regardless of the value (which seems like a really good "when temperature" rule: "when temperature changes"). As I mention above, you could create a rule for every possible temperature but that's not a very practical hack.

    Keep up the good work!
  • I couldn't really decide whether to accept or reject the answer - the first sentence I suppose answers the question, but the last question seemed to be a proposal for a workaround but I don't think it's a practical workaround.

    If you want to change the answer to accepted that's fine.
  • Gary, that's possible now. Just make sure your rule's "level" is beyond where you want to start collecting (above or below some threshold). You can tell it to post the data to a URL now.
  • I'm trying to do something similar. I have a Rails app set up to collect HTTP gets to record the temperature from my Twine: (code is here if you're interested:

    I've been able to trigger a recording manually by setting an orientation rule and flipping my Twine over, but I'd like to set my Twine to record at regular intervals. Once an hour is more than fine.

    Would setting 'reset after' to 3600 seconds do the trick? Is the specific logic for these settings documented anywhere?

  • No, and we do need to take the time to document. The reset time is the time before the condition can be triggered again. For example, if I put a magnetic switch on a swinging door, I might set the reset time to 10 seconds so that the rule isn't triggered as the door swings back and forth on one push.
  • Dang...I just did what Derek has already done. That's what I get for not perusing these discussions again. I have mine running in OpenShift, and its a lighter weight Sinatra app - pumping the data into Mongo. I'll post the code shortly.

    If I understand what Derek is stating about the reset time, wouldn't the rule trigger right after the reset time - if the condition is true? So...just set the temp to is above 0, or something and then the reset to 300 - to get an update every 5 mins?
  • The condition is true when it _crosses_ that temperature. Twine watches for the event. The reset value is the amount of time after an event that the condition can be evaluated again.
  • Ok - I'll watch this thread and wait for updates.

    Until then, I set a bunch of 'rises above' and 'falls below' rules within 65-80 deg F.

    Based on some of the other comments, it sounds like some kind of 'regular interval' rule would be very popular.
  • I am a long-time Indigo user, and a new Twine owner. I'd love to see integration between the two.
  • Twine will push data out using the RBS. But what if we have a way to poll twine for current metrics. Poll it any maybe it returns a JSON array with what all connected/integrated sensors are reading.
  • It seems like there are really two desires in this post. THere isn't a PULL style API yet, but there is a PUSH via http. As for updating anytime the temperature changes, I was extremely disappointed that it didn't with this myself. It's a software update, so lets hope. For me, it's the only useful intent I currently have, so to rig to to do more or less what I want, I'm getting the most sensitive piezo sensor here....

    and I'm rigging it on the breakout with two rules - on wiggle (on) send me the current temp. on on (stop wiggle) send me the current temp. Then i'm going to place it precariously somewhere that has vibrations. It wont be consistent, but it'll get me through until they add it. Or add movement begin/movement end on the accelerometer.
  • Jesse, you need one of those 'drinking birds' to tap the sensor.
  • Hey guys,
    I have found myself running into the same issue. I am trying to setup my Twine to post data to Cosm. And my code is working fine but there doesn't seem to be any good way to force an update. Perhaps I can use my breakout board with a 555 timer. Has there been any talk of being able to publish data to cosm or similar services?
  • If it's just to poll, I've thought about whipping something up in Python, using Beautiful Soup, to scrape the Twine data off the web site. Just don't poll too often (no point in more often than once per minute), that'd be rude....
  • My Twine is offline again, i.e. i took out the batteries. Even the simple rule set I had defined would stop firing. I always got one notification per event, but then the Twine simply went quiet. The temperatures changed, the events should have been triggered, nothing happened. When I connected to the web interface I got the message that my Twine last updated data hours ago. The only way to "get in touch" with it was to actually turn it over a couple of times. That is not making any sense as I want to use it to monitor something I do not get to on a regular basis (e.g. my attic or spaces in the cellar). Having to turn the device over to get it out of sleep is not an option.
  • +1 on allowing the device to push each update (regardless of rules) to a configurable external service. Assuming the push API were openly document, it would be just a simple matter of changing the configurable endpoint address?

    The hardware is great, but freeing the data for use with any external service would really generate an explosion of innovative uses. Right now I feel the Twine is somewhat limited by what functionality is present on the hosted software side of the Super Mechanical site.
  • I agree with the comments here. I put together a COSM bridge triggered via HTTP but it isn't firing regularly except for first time and test URL.
    A built in bridge to COSM would be nice as you could use the data from COSM in a variety of ways, however, the problem is the triggering - i.e. it isn't happening the way we'd all like it to.
Sign In or Register to comment.