Monday, June 8, 2015

Tying together the Moto360, Tasker, WatchMaker, and my Queue

I manage a Technical Support department.  Knowing how many new issues are in the queue is a handy thing, and being able to see tiny little pieces of info like that was why I bought the Moto360.

I wanted a speedometer; something I could glance at and get not only a number, but also a gauge of where that number is in our context.

When I got the watch, I'd not realized that this wasn't as simple as I'd hoped it would be.  I finally found a way to do it, and the documentation that I'd read on the subject wasn't great, so I thought I'd share a general how to.

First thing I did was mock up what I wanted the watch to look like in Inkscape.  I did a quick and dirty sketch like this:
So far, so good.  Next, still in Inkscape, I mocked it all up:

.. the hands aren't pictured, however I did mock those up as well, partially so that I could get the math worked out on the hands.  I also built an overlay with a message saying "Signal Lost" so that, if I'm not either on the company wi-fi nor vpn, I will know that the number on the watch is stale.

I pushed the pieces (hands, face, overlay) to Watchmaker.  This was ridiculously difficult, since you have to use either the Android Gallery or Google Photo to find the images.  After failing miserably to get them to show in Gallery, I uploaded the parts into Google Photos.

Arranging elements in WatchMaker is easy; one thing that saved me a fair amount of time was to set my hand images to zero position before exporting them to PNG's.

Next, I built a very quick and dirty Python script that provides a web response with the the number of tickets in our queue.

With that complete, it was time to turn to Tasker.  I found Tasker a real pain to get my head around, but here's what I needed:

1) A variable to store the hostname and port for that web service.
2) A variable to store the result of the query; that's getting passed to the watch.  That's %Que.  In Watchmaker, my value for the rotation of the hand is tonumber({tque}) * 4.8  (You will really want to use that tonumber function, even if you don't do the multiplication like I did.  I also set the digital value on the watchfact to just {tque}; since it's text, tonumber isn't needed.
3) A variable to store a number for the opacity of that "Signal Lost" image. %Slo; my opacity setting in WatchMaker for that image is set to {tslo} (no tonumber needed here).

In Tasker, I'm doing:
HTTP Get %ServerAddress
  If %HTTPR neq 200   #That is, I failed to get a response
    Set %Slo to 60
    Send %Slo to Watch (through the Watchmaker Plugin)
   Set %Que to %HTTPD #Return the value pulled from http query to the variable
   Set %Slo to 0
   Send %Que and %Slo to Watchface

.. and that's pretty much it.  I set the profile for this to happen between 8 and 6pm every weekday.

Here's what it looks like running:

.. Hope that helps someone out there!

1 comment:

  1. Didn't help me none, but I like yer watch. ;-)