Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mobeent/fitbit2garminMissingTcx

Repository files navigation

Fitbit to Garmin For Missing TCX

Lint status
Code style Linter Formatter Types checker Build tool
Project license

Downloads Activities in fitbit that don't have a tcx or have an empty tcx and create garmin supported activities using the heart rate and calories data only

Synopsis

This package is an extension/modification of the code found in the github repo fitbit2garmin

While that package works perfectly for weight, activity data and activities with GPS data it doesn't import data related to activities that only have heart rate data over time.

This package uses the activity data which includes a link to the time series heart rate and sometimes calories data and uses a script that creates a custom .tcx or .fit file that you can then upload into garmin

Limitations

This package requires a little more customization based on your activities data!

Authorization Token

The URL provided by the activity data is not an endpoint that the script originally supported as it is based on the UI endpoint which is not exposed and uses different Authorization tokens. Luckily you can just call it if you can get the token by logging into the fitbit UI

This can be done by: Going to fitbit UI -> Rigth click -> Select Inspect -> Go over to the network tab -> Login -> Click on any endpoint and get the authorization token from the request headers You can then add the token where it says <ENTER YOUR TOKEN HERE>

Activity Types

For .tcx files all activities apart from Walking and Running gets categorized as Other, if you do not have any issues with that you can just create tcx files. If you want to preserve the activity type you would need to create a .fit file and also update the FITBIT_TO_FIT_TOOL_SPORT located in create_fit.py to map your activity to the appropriate garmin supported activity type

Privacy

The CLI runs on your computer and your data is only visible and accessible by you. The CLI does not share nor send your data to third parties.

Usage

  1. You can install this library locally using the commands below. If you don't have it already, you need to install poetry first.
# Clone the repo
git clone https://github.com/simonepri/fitbit2garmin
# CD into the created folder
cd fitbit2garmin
# Create a virtualenv and install the required dependencies using poetry
poetry install
  1. You would then need to update the Authorization token from fitbit UI

  2. You can then run commands inside the virtualenv by using poetry run COMMAND fitbit2garmin create-activity-fit -s 2025-04-23. For end time you can also pass a -e <date> flag. For any activity that has a valid tcx or is missing heart rate data the script stops for user input, in that scenario you can either skip it if the tcx was already generated by original package or add a manual entry into garmin using the json activity file generated. You can also remove the user input line located in commands.py

Tip: The process will take several hours or even days depending on how many years of data you have. You can speed-up the process by adjusting the start/end date used by the script using the -s YYYY-MM-DD and -e YYYY-MM-DD flags.

Tip: You can stop and resume the download at any time by just killing and re-running the above command. The CLI will continue automatically from where it left.

  1. From Garmin Connect, log into your account then select the import icon in the top right corner of the page (cloud with upward arrow icon).

  2. Select Import Data.

  3. Select Browse.

  4. Locate and select the files exported by the CLI.

Tip: I strongly recommend to upload up to 3 months of data at a time.

  1. Select Import Data.

  2. Select the units of measure that match what you used with Fitbit.

Tip: If you mistakenly import a file using the wrong units of meaures, simply re-import it again. The Garmin Connect importer will replace old imported values automatically.

  1. Select Continue.

Tip: If the import for some file fails, try to refresh the page and re-import then again. The Garmin Importer is smart enough and you won't end-up with duplicated data if you import the same file twice.

  1. To Uninstall you can simply delete the github repo folder

Disclaimer

This product is not sold or affiliated in any way with Fitbit or Garmin, and they do not service or warrant the functionality of this product.

Development

If you wish to contribute to this project, run the following commands locally before opening a PR and check that no error is reported (warnings are fine).

# Run the code formatter
poetry run task format
# Run the linter
poetry run task lint
# Run the static type checker
poetry run task types

License

This project is licensed under the MIT License - see the license file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages