Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Sunday, January 10, 2016

Update on the journey to Mount Doom via FitBit

I know I just posted about this yesterday, but I've put some more work into this (while procrastinating other things, naturally).  To recap from yesterday, this is what I wanted to accomplish in "Day 2":

  1. Figure out where IFTTT adds the next row of data (i.e. above or below the first row?)
  2. Confirm the distance in miles from Hobbiton to Mount Doom in Miles, convert to Kilometres
  3. Take the task I started yesterday, and put it together with a task to tell me how many kilometres I've travelled, and how many I have left to go.
I'll tackle these in order here...

#1 was important because I needed to determine how I was pulling the data from Google Sheets.  In my task yesterday, I was just pulling R1C6, which in my spreadsheet translates to F1.  IFTTT adds the next row of data below the original row, rather than pushing it to the top (see here).  So this means my task works for January 8th - but for the 9th, I need to pull R2C6 (F2), R3C6 for Jan 10th, and so on.  

So I created a test sheet with 10 rows of data to use.  Then I created a task to add 1 to a variable (%Rownumber).  Without going into too many details, I set a variable called %Frow to R%RownumberC6.  I set %Rownumber to 0 initially so that the first time it runs, I'd get R1C6.  Simple!  

For #2, I found this website (appropriately called Nerd Fitness).  I don't know where this person got their numbers, but a second source confirming 1779 miles is good enough for me.  There's also a breakdown of how many miles between each stop, and number of miles for the return journey - but I need to get to Mount Doom first, so I'll come back to that later.  1779 miles = 2863 kilometres.  

#3 was a bit easier, since I already had the task to pull the data completed.  I just changed "R1C6" to "%Frow" - which means that it will change to R2C6, R3C6, etc. as needed.  Another task called "Distance" does a couple things: 

  • Sets the distance travelled (%DistanceTravelled) to "%DistanceTravelled + %Kms" (%Kms is set in "Get Kilometres", which is the task I described above)
  • Sets %RemainingDistance to "2863 - %DistanceTravelled"
After that, I put it all together into one task called "Display" that runs each task in order, and then sends it to a notification.  Here's a screenshot: 


I'm going to have to change the message to say "yesterday" instead of "today" - since it's not in real time (it would be if I could directly access the FitBit API...).  I don't know where that leaf icon comes from but it's a built-in icon, and I thought it was appropriate for this.  

Next on the to-do list: 
  • Figure out how to automate this process (I get a notification when IF updates the spreadsheet, so that could be the trigger)
  • Figure out how to incorporate the distances between towns (i.e. Hobbiton to Rivendell is 737.1km, etc.).
I think once I get those two things done, that's pretty much where I'm going to leave it.  One thing that I could do for posterity is add each update to a text file.  That's a pretty easy thing to do - I think I might just add that step tomorrow when I test the automation process.

Saturday, January 9, 2016

The nerdiest thing I could think of to do with my new FitBit

Vanessa gave me a FitBit for Christmas - specifically, the Charge HR.  I've done some nerdy things with it - like figure out how to send more than just phone call notifications to it.  So far I can send text messages, and when activated, sports scores.  Fantastic!

I thought that was the end of my fiddling with it for now; I figured I would probably play with it a little more here and there, but for now, I'd use it as intended.  But then I saw this thread over at Reddit's Loseit community.

Now, I'm not a big Lord of the Rings fan; but I thought that this would be something fun to try and put together using Tasker.  To summarize, the goal is to walk the distance from Hobbiton to Mordor over the course of at least 366 days.  The distance is apparently 1779 miles - I'll have to substantiate this number, but that translates to 2863 kilometres.

Using a spreadsheet to track this is great and all - I've tracked fitness stuff via spreadsheet tons of times.  But I thought I'd go one step further, since part of why I like the Fitbit is that it automates some of the data entry for me (tracking exercise, etc.).  Enter Android, Tasker, IFTTT, and Google Sheets.

It took me a while to get this set up - mainly because I wanted to use the FitBit API to pull the information via Tasker, but I haven't been able to get that going yet - but I have IFTTT sending daily status updates to Google Sheets.  It gives me the date, total steps taken, flights of stairs, elevation (in metres), and the most important piece to all of this, how many kilometres I've walked.

Now, the fun part - pulling the data from Google Sheets.  It's a bit of a pain, but this guide from Peter's Tech Notes was pretty easy to walk through.  So, now in Tasker I've successfully pulled the number of kilometres I've walked from my FitBit data: 6.11 kilometres on Jan 8th (only 2,356.89 km to go to Mordor!).

But I'm not done there.  I still have some more tests to run, because I need to figure out how I want to use this information.  I have several thoughts - the easiest way to go about it would be to create a daily notification at the start of each day telling me how far I've gone, and how far I've left to go.  But that's kind of boring.

I bet there are some complicated ways I could go about incorporating a graphical interface with this.  But that'll come - the first steps will indeed be to set up a daily notification to tell me how far I've walked and how far I have left to go.  I'll start small first - basically, it will tell me the distance between how far I've walked and the total I have left (so this morning I'd see 2356.89 remaining).

The next step would be to break it down further, and show all of the stops in between.  The next step after that would be to try to incorporate some graphical element, if possible.  Or at least something to make it look nicer.

The last step would be figuring out the return journey - I suppose it would just be a matter of reversing everything I did in the first bunch of steps.

This will be a work in progress, and something I'll keep updated here.  I'll share my Tasker profiles as I go, for anyone interested.  Note that for this to work, you'd basically have to substitute all of your own data for the Spreadsheet part, but other than that, it should work as expected.

Here's the test I wrote up - you'll have to download the Snackbar Plugin for it to work, but you could easily just change the last part to one of Tasker's built-in notification options.

Monday, August 17, 2015

New podcast: Electronic Monologues Episode 2: Kilobyte

In this week's episode, I keep it short and to the point and drop the music from the show, resulting in an ultimate savings of 3 minutes. Not as short as I thought it would be in the end! Other things talked about: stuff I learned since episode 1; some new notebooks I picked up from Dollarama; my weight loss struggles; the Ottawa Champions; Pokemon Sapphire; and the nerdiest of all, Tasker for Android. Enjoy!

Direct MP3 Download

RSS Feed (It works this time, I promise!)