Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calories not syncing from Strava to Garmin Connect #353

Open
prueker opened this issue Jul 13, 2017 · 7 comments · May be fixed by #364
Open

Calories not syncing from Strava to Garmin Connect #353

prueker opened this issue Jul 13, 2017 · 7 comments · May be fixed by #364

Comments

@prueker
Copy link

prueker commented Jul 13, 2017

Everything else including power, heartrate is syncing, but the calories are 0.

@sergmelikyan
Copy link

I confirm this issue, Calories are not synced to the Garmin Connect, but I think this is caused by the broken export (from Strava?) rather than import - tcx files which I use for exporting to Dropbox also doesn't contain this information:
<Calories>0</Calories>

@sergmelikyan
Copy link

@prueker are you also exporting from Strava to Garmin Connect? Or some other source?

@cpfair anything else we can do to help with this issue?

@sergmelikyan
Copy link

sergmelikyan commented Jul 26, 2017

According to strava this value is provided in a field calories: http://strava.github.io/api/v3/activities/ which we actually read in https://github.com/cpfair/tapiriik/blob/master/tapiriik/services/Strava/strava.py#L178

I also confirmed that this field is indeed is returned correctly by Strava.

@prueker
Copy link
Author

prueker commented Jul 26, 2017

@sergmelikyan Yes my issue is sync from Strava to Garmin Connect, as I said all other fields do sync, but the calories are 0.

@sergmelikyan
Copy link

sergmelikyan commented Jul 27, 2017

Looks like problem is on the side of reading activities from the Strava, in strava.py on line 130 we are doing request to Strava to read all activities for the given athlete like this:

https://www.strava.com/api/v3/athletes/<user-id>/activities

Which according to Strava API Reference here doesn't contain "calories" field for individual activity, only "kilojoules" for rides and nothing for runs for example.

My experiments confirm that output data from this requests doesn't contain this field. I have create new API app on this page and used provided Access Token to execute following cUrl:

curl -G https://www.strava.com/api/v3/athletes/9535682/activities -d access_token=<my-access-token> > output.json

Now question is how to resolve this? Here are my thoughts:

  1. Use different API call to get information about activity which has "calories" field
  2. Calculate calories by ourselves
  3. Reach out to Strava developers and ask to include this field or help to workaround this

Method 1: Different API Call
I spent digging through Strava API Reference and seems like the only API call which return this value is

https://www.strava.com/api/v3/activities/<activity-id>

Which means that we will have to do "1 + 2*x" instead of "1 + x" API calls to Strava where x is number of activities to sync given that we insert this additional call somewhere here: strava.py line 212

This will significantly increase time and load on the system as well as overall API call numbers which are rate limited.

@cpfair what do you think about load which will be generated if we will switch to request per activity model?

Method 2: Calculate value by ourselves
Right now it seems impossible to calculate this number in the same way as Strava does, I was not able to find algorithm which we can replicate based on the data provided by following call:

https://www.strava.com/api/v3/athletes/<user-id>/activities

Method 3: Reach out to Strava developers
I have reached out to Strava developers via e-mail asking how we can deal with this, as well as want to mention @stravadk in hopes he can provide some feedback here.

References:

  • Strava API Reference: Activities
  • Output 1: List of activities for given athlete (me) - attached output-1.txt
  • Output 2: Specific activity (my last ride) - attached output-2.txt

P.S. Seems like providing is In the current API call to list activities is excessive and can be safely dropped:

https://www.strava.com/api/v3/athletes/<user-id>/activities

sergmelikyan added a commit to sergmelikyan/tapiriik that referenced this issue Jul 27, 2017
Strava does provide information about how many calories user spent during
activity only when details on specific activity is requested.

Additional API call was added to request activity details during downloading
activity in order to obtain calories information.

Previous behavior was to collect calories stats from the response to request
of the list of user activities which doesn't contain this information.

Closes cpfair#353
@sergmelikyan sergmelikyan linked a pull request Jul 27, 2017 that will close this issue
sergmelikyan added a commit to sergmelikyan/tapiriik that referenced this issue Jul 27, 2017
Strava does provide information about how many calories user spent during
activity only when details on specific activity is requested.

Additional API call was added to request activity details during downloading
activity in order to obtain calories information.

Previous behavior was to collect calories stats from the response to request
of the list of user activities which doesn't contain this information.

Closes cpfair#353
@sergmelikyan
Copy link

Method 3: Reach out to Strava developers

I have received response stating that somewhere in the beginning of the next year "calories" value might get more exposure, but right now the only way to get this value is using aforementioned call to get activity details.

@CASNetlink
Copy link

It looks like this is unchanged in April 2022 - calories are not included in API v3 calls to https://www.strava.com/api/v3/athlete/activities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants