Wednesday 18 February 2015

WatchMaker with Tasker for automation

Tasker is a very popular app for automation, in fact it describes itself as "Total Automation, From Settings to SMS".  I'm only just starting to use it, and I can already see that there's loads of potential.  In short, you create profiles, which get activated by certain conditions, and tasks, which are a series of actions and can be run when these profiles activate or de-activate.  I'm not going to go into too much detail though, as this is an Android Wear blog, and not an Android blog.  

Having said that, here's a WearTasker app, which allows you to trigger tasks directly from your watch, which could prove to be very handy!  There's also integration with WatchMaker, allowing you add a "tap action" to any element of the watch face, and the action can be to trigger a task.

What really interested me initially though was the ability for Tasker to set global variables, which can then be passed through to WatchMaker, allowing you to display values on your watch face which the phone can update.  

I was interested in doing a World Community Grid watch face.  World Community Grid enables anyone with a computer, smartphone or tablet to donate their unused computing power to advance cutting-edge scientific research on topics related to health, poverty and sustainability.  For all the work that you process, you are rewarded with points.  I wanted to see my points, and my current rank, right there on my watch!  This is what I came up with...

World Community Grid - 20 downloads

So I've already said that I don't want to do a full on Tasker review, but here's roughly what I did...

  1. Create a new task in Tasker
  2. Set Tasker variable %WCGUserName to "rik_lewis" (my username)
  3. Get my statistics as an xml stream from https://secure.worldcommunitygrid.org/stat/viewMemberInfo.do?userName=%WCGUserName&format=xml
  4. Split the results to get the bit between "<Points>" and "</Points>"
  5. Set Tasker variable %WCGPoints to the points value
  6. Split the results to get the bit between "<PointsRank>" and "</PointsRank>"
  7. Set Tasker variable %WCGPointsRank to the rank value
  8. Send both variables to WatchMaker
Here are some screenshots with more details...


Then create a new profile in Tasker which is triggered by time, repeating every hour, which runs your task...


This means that every hour the task will run and fetch the values, and send them through to the watch face.  To reference these variables in WatchMaker you use the tags {twcgpoints} and {twcgpointsrank} respectively.  In fact any Tasker variable is reference with the tag {t...}, which is nice and simple to remember.

All in all this works very well, and is so powerful when it comes to customising your watch.  Regularly fetching up-to-date data from the web is just one idea, you could also send the current wifi network name each time you connect, or hundreds of other things.

No comments:

Post a Comment