philosowaffle / peloton-to-garmin

Convert workout data from Peloton into JSON/TCX/FIT files and automatically upload to Garmin Connect
https://philosowaffle.github.io/peloton-to-garmin/
GNU General Public License v3.0
271 stars 356 forks source link

[FeatureRequest] Training Load / Effect not included #114

Closed derekkvedar closed 2 years ago

derekkvedar commented 3 years ago

Garmin uses HR data to create Training Load and Training Effect (aerobic, anaerobic). Not sure how to fix this

philosowaffle commented 3 years ago

Are you using V1 or V2?

derekkvedar commented 3 years ago

v1.2.0, latest release. I can try V2 if there's fixes there

philosowaffle commented 3 years ago

I don't think this is showing up on V2 either. If there is a fix, then it would likely only be possible on V2.

According to Garmin Training Load/Effect is only a feature available on certain Garmin devices. Even though the article states the following,

However, Firstbeat has created a patented method for estimating EPOC from heart rate data gathered during your workout.

Naturally we would assume that any device that captures HR data should be eligible for estimating EPOC based on the above statement. BUT the fact that only certain Garmin devices support this features (despite all Garmin devices providing HR data) indicates that really

Training Load = HR + Magic Equation that lives on the Garmin device

For instance, on my Venu, I did an outdoor run today that captured a lot of data including HR. But I do not see any Training Effect or Load score. Apparently, that's not a feature I get even though Connect should have enough data to calculate it.

I can do more research on this. But my hunch is that this is a uniquely Garmin Device feature we will not be able to match.

derekkvedar commented 3 years ago

Concur. Logic checks.

SyncMyWorkout merges a watch recording (to get training effect with magic equation on garmin device) with the peloton data (HR + Power, etc) to create one file that has everything. Not sure if that is worthwhile to explore here as well.

philosowaffle commented 3 years ago

If you're able, could you upload to this ticket:

  1. FIT file generated by your watch
  2. The final FIT file (after merge) generated by SyncMyWorkout

I should be able to reverse engineer what is involved in merging the two files together. I've also read through the SyncMyWorkout blog post about this, and have a rough idea what they are doing. I'm not sure if I'm ready to commit to building out something quite that fancy. But I will certainly begin the research and see what it would take.

derekkvedar commented 3 years ago

image moderately concerned SyncMyWorkout's Terms Of Service will get us in trouble for doing that here. Let me know your thoughts - it looks like anyone can create an account and get a week of free downloads prior to payment...

philosowaffle commented 3 years ago

Yeah, lets not go against the Terms of Use.

Instead. if you have a non-Peloton workout from your watch uploaded to Garmin that includes the Training Load number, you should be able to export the FIT file and upload that here. I mostly just need to see exactly which Field in the FIT schema is used for capturing this data. Or you could upload just the original watch FIT file from you Peloton workout.

I use Garmin's official SDK for creating the FIT files V2, but its documentation definitely still leaves something to be desired. So having original watch data examples to work from is very helpful.

derekkvedar commented 3 years ago

6817118891.zip 6671473764.zip Two different examples of files with training load - one with GPS data, one as a Peloton ride but from the watch, so only HR data included

philosowaffle commented 3 years ago

https://discover.garmin.com/en-US/performance-data/running/

philosowaffle commented 3 years ago

Brainstorming ideas on how this might work:

  1. Attempt to auto-sync watch file from Garmin
    1. Fetch recent workouts from Garmin
    2. Attempt to find workout with similar time stamp and workout type matching the Peloton workout
    3. Download the Garmin workout data and merge with the final Peloton FIT file
    4. Upload final FIT file to Garmin
    5. Optional: delete original watch file
  2. Manually merge files
    1. Somehow have user provide the watch file that should be merged with the final FIT file for a given Peloton workout
    2. merge the files
    3. Upload final FIT file to Garmin
Mr-Gavster commented 3 years ago

Hi there,

I've used this project when it was primarily a python codebase but now you've moved it over to C# I've taken more of an interested in the implementation.

I'm also interested in this issue, so I spent an afternoon looking into it. I think the workflow outlined above makes sense, but I believe you could retrieve the Garmin data without needing to download the FIT file.

I'd need to confirm the initial look I had, but if it would help I can create a PR to extend the ApiClient client and add support for:

  1. Retrieving summary information for recent activities, including Activity Id, Activity times (start time, duration, etc), Type, Training Load and Training Effect.
  2. Delete Activity by Garmin Activity Id.

Depending on the time, I could also implementing a first pass of matching Garmin workouts to the downloaded Peloton ones. I would say I'd also tackle the FIT encoding, but that looks like a minefield. But I'd be willing to have a look to see if I can make time to implement it?

Would you be interested in a PR of the above? Might take me a week or two depending on work commitments.

philosowaffle commented 3 years ago

Yeah, would love a PR that at atleast gets the ball rolling! Especially good news that we may be able to fetch the data from Garmin without having to download the whole FIT file.

philosowaffle commented 3 years ago

I recently got a Fenix 6 and have been playing around with Garmin's Training Status feature through it.

As documented by this feature request already, I have observed that my Peloton workouts synced via P2G do not have any Training Status/Effect on the Activity itself.....

BUT when I go to my Training Status summary pages in either the app or on the web, my Peloton workouts are accounted for and included there. I can see what appear to be accurate Training Status/Effect and Load. This is also without me recording any activity on my watch, solely relying on the synced activity from Peloton.

Right now I'm doing a lot of running and only using Peloton for recovery cross training, so I don't have a lot of variety in my Peloton workouts to compare with, but this feature seems to more-or-less be working.

So my question is, am I missing something? Do we gain anything extra by having the training effect show up on the Activity view itself?

Screen Shot 2021-08-18 at 8 20 44 AM Screen Shot 2021-08-18 at 8 22 19 AM
derekkvedar commented 3 years ago

I had just posted somehting about this being complete. But I noticed something: image P2G uploads include TSS but no "aerobic training effect". Garmin uploads include the opposite.

Another interesting note: take the Aug 1 ride as an example. image

It appears that they are calculating different Training Load scores, and therefore scoring their "focus" (ie low aerobic, high aerobic, anaerobic) differently. Very curious, not sure what might cause this. Best guess is that, just like Garmin can only use HR on a treadmill, but uses pace outdoors to figure out things like VO2 max - on the peloton, it can use power in addition to HR to figure out a better estimation of what kind of ride you did.

derekkvedar commented 2 years ago

I think this can actually be marked as solved. It provides a Garmin Training Load for each activity. It doesn't exactly match what Garmin might produce, but it's close enough and consistent that I think it is complete.