Tracktor: Managing Harvest Timers the Arduino Way
Here at Viget, we all use Harvest to track how we spend our time. It’s a great tool that makes it easy to keep track of time spent on various client and internal projects ... but I knew the experience could be better.
While I find the Harvest interface clean and simple to use, it’s often hard to track down where my tab is, especially considering the web’s recent affinity for the orange-background-white-letter favicon combo.
While loading up a fresh tab (or using the desktop app), finding the desired timer, and switching it on only takes a second and a half, I knew there was room for improvement. Those second-and-a-halves add up.
Switching timers now takes as much time as it takes to push an arcade button, and, generalizing my audience here, I’d put money on that being pretty speedy.
A Sinatra app, “Farmer” runs locally which allows me to store “Plants” (Harvest timer IDs paired with Button numbers) in a database, and make “toggle” requests through the Harvest API whenever a request to
/toggle?button=[number] is made to the app.
On the hardware side, I’ve hooked up 6 buttons and 6 LEDs to my trusty Arduino, and have chosen to use the Dino gem to control the Arduino components with ruby. A script named “Plow” (that’s right, farm metaphors for everyone) runs and continuously listens for button presses. Whenever a button is pressed:
- the number (1 through 6) is added to the query string of my HTTP request to Farmer
- Farmer then triggers the Harvest API toggle request with the appropriate Timer ID
- Farmer then parses the response and sends back status information (request success and on/off timer status) as JSON
- Plow reads the response and instructs the matching LED to reflect the status of the timer.
The end result: if I’m catching up on emails and an emergency request comes in on Client Project X, I raise my hand, swing it down with an authoritative and satisfying “click” on the Client Project X button, and get to work. About .25 to .4 seconds later, I spy from the corner of my eye a two LEDs exchange state, and I know my time is being tracked appropriately.
I’m well aware there’s room for improvement on the Tracktor. Plans for Phase Two involve any number of the following:
- a smaller physical device
- a much much larger physical device
- foot powered controls? (“I’d like to be surrounded by buttons and switches so I could feel like a pilot.” -Co-worker)
- a snazzier and more intelligent Farmer
- a Raspberry Pi running Farmer and Plow so it can be free from my computer
- whistle and/or bow and arrow activated timer changes
- clean up this mess
If you have any cool ways you’re tracking your time, have some thoughts on the Tracktor, totally hate it, or want to make one yourself, let me know in the comments below!
And as always: the code for all to share/criticize: Tracktor