Promo: Have a resolution to run/bike at least X kilometers this year? Checkout fitgoal - it helps you keep track of your yearly distance covered with a neat graph. Preview my graph.
Export all your Fitbit data to Google Fit. If you find this useful, please star ⭐ the repository on Github.
Unlike other alternatives, such as fitnessyncer.com, this aims to offer very fine granularity for the data.
- Steps - minute level precision
- Distance - minute level precision
- Heart rate - second level precision
- Weight
- Body fat percentage
- Activities
- Running
- Swimming
- Biking
- Volleyball
- Walking
- Badminton
- Workouts
- Fencing
- Cricket
- Football
- Hiking
- And a few others -- suggestions welcome!
- Calories - minute level precision
- Sleep logs - minute level precision
- Floors - minute level precision
- Elevation - minute level precision
- Food logs
You have to register your own Fitbit and Google Fit applications. This setup is a one time thing.
- Install dependencies
This is a python3 application so install all the dependencies
- Create virtualenv
virtualenv fitbitenv
- Activate env
source fitbitenv/bin/activate
- Install dependencies using
pip3 install -r requirements.txt
- Fitbit setup
All instructions below must be performed using the same Fitbit account you want to sync with Google Fit.
- Register a new Fitbit application on Fitbit Developers Console
- Use the information below:
Application Name : --
Description : --
Application Website : --
Organization : --
Organization Website : --
OAuth 2.0 Application Type : **Personal**
Callback URL : http://localhost:8080/
Default Access Type : Read-Only
Note :
1. Use your own information for fields marked --
2. Make sure you copy the Callback URL exactly (including the last /)
3. Application Type MUST be Personal
- Hit save and make a note of
OAuth 2.0 Client ID
andClient Secret
- Navigate to auth folder
cd /auth
- run
python3 auth_fitbit.py -i <client-id> -s <client-secret>
- This opens a popup in the browser. Authenticate and done!
- Google Fit setup
- Go to the Google Developers Console
- Click
Continue
. Then selectGo to credentials
and selectClient ID
- Under Application type, select
Other
and hitCreate
- Make a note of
client ID
andclient secret
- Navigate to auth folder
cd /auth
- run
python3 auth_google.py -i <client-id> -s <client-secret>
- This opens a popup in the browser. Authenticate and done!
Update the config.ini
with own choices and start the sync using python3 app.py
- With date stamps :
python3 app.py -s 2016-08-20 -e 2016-08-22
- Last 3 days :
python3 app.py -s "2 days ago" -e tomorrow
- January month :
python3 app.py -s "jan 1 2016" -e "feb 1 2016"
You can setup a cron task to automatically sync everyday at 2:30 AM.
30 2 * * * /path-to-repo/fitbit-googlefit/cron.sh >> /path-to-repo/fitbit-googlefit/cron.log 2>&1
Add above line to your cron tab: crontab -e
in Linux. Sync logs will be stored to cron.log
in repository.
If you want to do the authentication process on a system without a display - such as a raspberry pi or a remote server, pass --console
or -c
option to the authentication scripts. See below examples.
python3 auth_fitbit.py -i clientid -s clientsecret --console
python3 auth_google.py -i clientid -s clientsecret --console
- Get command line help using the
-h
flag. - Arguments passed through command-line take higher priority over
config.ini
values.