How-To: Chart Twine’s Course
Hey! My name is Risto and I do a little of everything here at Supermechanical. Most of my time is spent programming, assembling, and shipping your Twines around the world, but occasionally I get the itch to experiment with cool new ways to connect my world to the internet, like using Twine and HTTP requests to track the temperature at my house.
My AC has been acting up recently at home; every now and then it just cuts out. It’s not a big deal for me because I don’t usually leave perishable food lying around, but my StellaDog doesn’t really appreciate sweating it out the whole day. I set up my Twine to shoot me an email when the AC cuts out so I can come to her rescue as needed.
After I received a couple of email notifications I decided to use an HTTP request and ThingSpeak with my Twine to keep track of how often my AC is dying so I can prioritize getting it fixed.
When Twine’s rules are triggered, Twine can use an HTTP request to send information to ThingSpeak, and Thingspeak will graph the data from Twine and your world.
Twine notifies you when rules are triggered, but it doesn’t constantly log small differences in data. Remember: Twine will allow up to 30 notifications per hour.
To get started you’ll need a Twine and a free account at https://ThingSpeak.com.
First, set up an account at https://ThingSpeak.com/
Once you are signed in, click on “channels” tab, near the top left of the home page. Click on “create channel”, and you will see your new channel with a blank graph. Then click the “data import” tab. The second box on the right side of the page will include a link to tell your Twine where to send its data. The link should look something like this: http://api.ThingSpeak.com/update?key=YOUR_API_KEY_HERE&field1=0
Highlight and copy the link in the second box.
Next, go to your Twine’s rules, and create a rule for the temperature you want to monitor. I chose 79º F because that’s the high end of Stella’s comfort range. Side note: if you save an HTTP request with a Celsius temperature trigger, the rule will trigger, but the value will be translated to Fahrenheit (for now, we’ll be fixing this!).
Click “add an action” and choose “HTTP request” from the menu.
Paste the link you copied from ThingSpeak into the box.
Remove the “0” from the end of the link and then click on the sensor value you want your Twine to send to ThingSpeak (I used temperature).
Save the rule to your Twine and voila! Now, Twine is talking to ThingSpeak, and I can make sure StellaDog doesn’t turn into a hotdog.
If you go back to ThingSpeak and click on the “channel settings” tab. You’ll be able to edit field labels, add your location, and customize your chart.
What are you using your Twine and HTTP requests to track? Share in the Twine Community!