Git Product home page Git Product logo

shantanu1227 / fitbit-googlefit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pkpio/fitbit-googlefit

0.0 1.0 0.0 247 KB

Export Fitbit data to Google Fit. Unlike the alternatives such as fitnessyncer.com, this offers very fine intraday granularity (every minute/second data).

Home Page: http://pkp.io/blog/fitbit-to-googlefit-sync/

License: GNU General Public License v3.0

Python 99.88% Shell 0.12%

fitbit-googlefit's Introduction

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.

Introduction


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.

Fitbit Steps GoogleFit Steps demo

Features


  • 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

Setup


You have to register your own Fitbit and Google Fit applications. This setup is a one time thing.

  1. Install dependencies

This is a python3 application so install all the dependencies using sudo pip3 install -r requirements.txt

  1. Fitbit setup

All instructions below must be performed using the same Fitbit account you want to sync with Google Fit.

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 and Client Secret
  • cd /auth and run python3 auth_fitbit.py -i <client-id> -s <client-secret>
  • This opens a popup in the browser. Authenticate and done!
  1. Google Fit setup

  • Go to the Google Developers Console
  • Click Continue. Then select Go to credentials and select Client ID
  • Under Application type, select Other and hit Create
  • Make a note of client ID and client secret
  • cd /auth and run python3 auth_google.py -i <client-id> -s <client-secret>
  • This opens a popup in the browser. Authenticate and done!

Usage


Update the config.ini with own choices and start the sync using python3 app.py

Sync examples:

  • 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"

Setup autosync:

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.

Headless authentication


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

Note :

  1. Get command line help using the -h flag.
  2. Arguments passed through command-line take higher priority over config.ini values.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.