Friday, June 09, 2023

Garmin and Tasker: Sending an I'm Here message when an activity is complete

One common exercising arrangement is for Shira and I to drive to the gym together. She then attends a class while I use the time to run in the area. Typically, after about an hour hour, we meet back up to compare notes. When she leaves the class, if I happen to be out of sight, she's not sure if I'm done running and walking around the block or if I've opted to overdue it and am still 3 miles away. The courteous thing to do is to text her when I'm done running so she knows where she can find me. After doing this a few times it occurred to me that surely I could automate this process.

A First Attempt: Using the Garmin Tasker App

My first thought was that I could use the Garmin Tasker App to add a notification feature to my Garmin Vivoactive 4 watch. After running I'd click a few buttons on my watch, which would ultimately invoke Tasker, which would send Shira an "I'm here" message and a Google Map link.

I'd been meaning to set up the link between Tasker and my Vivoactive watch, so perhaps this was the perfect example to start with.

One challenge is that the integration between Garmin and Tasker is primitive to say the least. The watch app works by asking the phone to navigate to a synthetic URL. This URL can be intercepted by Tasker and code can be executed. This is a clever work-around but isn't obvious to configure.

A Simple Solution: AutoNotification Intercept Event

While I futzed with the Garmin Tasker watch app, I realized there was an easier solution to my problem. When I finish running I stop the Garmin run activity I started at the beginning of my jog. This records the stats for my run and is now second nature to do. A minute or two after I stop the activity, I get a notification on my phone that "Your activity is ready to view." It occurred to me that I could use the AutoNotification plugin for Tasker to detect this message. I could then send Shira my location based on this event.

To build this out, I need to create a Tasker Profile which is initiated by the AutoNotification Intercept  event.

The tricky is configuring the AutoNotification Intercept event to make it react to the Garmin notification. Thankfully, AutoNotification comes with a nifty "Fill From Current" option that fills in these details for you:

With this profile configured, the rest of the code was straightforward. The AutoNotification Intercept event triggers the Garmin: Activity Complete task, which in turn calls the Text My Location task. You can download the profile and corresponding tasks from Taskernet. You may also need the Text My Location and Where Are You tasks for this to function.

With this code in place, Shira is automatically notified of my location after each run. Life automated; problem solved!

No comments:

Post a Comment