Showing posts with label tasker. Show all posts
Showing posts with label tasker. Show all posts

Thursday, 19 February 2015

Tasker - making use of javascript

Yesterday I posted about using WatchMaker with Tasker for automation, and I built a watch face that used Tasker to update variables which were displayed on screen.  Here it is...


World Community Grid - 20 downloads


However, it bugged me that I couldn't quite get it to look right, I wanted to add thousand markers to the rank (#215,027) and points (181,052).  I couldn't figure out a way to do this in WatchMaker, or in Tasker, until I discovered the javascript option.  In Tasker you can add a step in the task which runs javascript, which can access the global variable that you've already set, re-format it, and then set the global variable again.  Here's what I did...




I'm not going to explain the javascript, because that's not really the point, but you can find out more about the javascript API and what's available in Tasker here... http://tasker.wikidot.com/userguide-en:javascript.

The end result is this...


It's a small difference, but I think it looks much better.  And I love that I found a way to make the watch display exactly the way I wanted.

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.

Sunday, 15 February 2015

Job one - the watch face

For me, the first job on getting the watch was to find a watch face that I liked.  And I've found way too many that I like, and not enough time to try them all!  But what I really like is designing and building my own.

There are two main apps for that; Facer and WatchMaker.  I've played with both, and I have to say that the later is my favourite.  There are many discussions online, with people arguing either way, but at the end of the day I think it comes down to personal preference.  However, here's my list of reasons...

  1. WatchMaker can import Facer files (.face) as well as it's own (.watch) and Facer can only handle it's own
  2. WatchMaker has many more customisation options than Facer
  3. WatchMaker has Tasker integration (that's a whole other post in itself!)
  4. WatchMaker has support for animated gif images
I'm sure there are more, but those are the main points for me at the moment.

There are lots of ways to get watch faces, included buying them from the Play store, but one of the best free repositories I've found is FaceRepo.  The site can filter on round/square faces and Facer or WatchMaker files, making it easy to find ones suitable for your watch.  It also allows you to create an account and upload your own watch faces.  

I love downloading watch faces, importing them into my WatchMaker app, and then customising them to suit my own needs.  Maybe I want the date formatted differently, or 24 hour time instead of 12 hour time, or whatever - easy!  

You can either view the site and download the files directly, or you can browse on your computer and then use a QR reader on your phone to quickly and easily download.  You can also get the .watch files from other sites and import them, as well as exporting your own creations as .watch files to upload and share.

Here are the top 3 watch faces that I've uploaded...



 

I've done 16 so far, including a range of Ron Swanson ones, and some Andy Fairhurst ones as well... http://facerepo.com/app/faces/user/trixmoto/1 - I hope you like.  Feel free to provide feedback, either here or on the FaceRepo site (requires a Disqus account).

I've learned some interesting watching making tricks already, and I'm sure there's more to learn as well, so keep a look out for some future posts on this subject!