fitsync

Synchronizes user data between several fitness services.

  • 所有者: tantalor/fitsync
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Fitsync is a python app that syncs data between Fitbit and Google Fit.

Currently, it only copies weight data from Fitbit to Google.

Setup

Environment

Use virtualenv to create an environment to install required packages,

$ virtualenv env

Activate the environment in your shell,

$ source env/bin/activate

Use pip to install the required packages,

$ pip install -r requirements.txt

Fitbit Credentials

Register a Fitbit application with:

  • OAuth 2.0 Application Type: Personal
  • Callback URL: http://localhost:8080/
  • Default Access Type: Read-Only
  • any values you want for application name, website, organization, and organization website
    Note the resulting OAuth 2.0 Client ID and Client Secret.

Run auth_fitbit.py to get credentials for read access to a user's data,

$ python auth_fitbit.py [FITBIT CLIENT ID] [FITBIT CLIENT SECRET] 

This scripts open a browser window where you can log in to your Fitbit account and authorize the app to "access your profile and data". When you accept, the script writes the credentials to a local file named fitbit.yaml.

Google Credentials

Create a project in Google Developers Console and enable the fitness API. Create an OAuth client ID with Other UI type and select User data. Note the client id and client secret.

Run auth_google.py to get credentials for write access to a user's body data,

$ python auth_google.py [GOOGLE CLIENT ID] [GOOGLE CLIENT SECRET] https://www.googleapis.com/auth/fitness.body.write

This script opens a browser window where you can log in to your Google account and authorize the app to "View and store body sensor data in Google Fit". When you accept, the script writes the credentials to a local file named google.json.

Usage

Use the patch command to download data from Fitbit and upload to Google,

$ python fitsync.py patch

Use the delete command to remove data from Google,

$ python fitsync.py delete

Use the get command to see the data stored in Google,

$ python fitsync.py get

There are a few options supported,

$ python fitsync.py --help

=======

Cron

The included cron.sh script can be used to keep your Fitbit and Google Fit data in sync automatically.
Simply add the following line to your crontab to run the job daily at 11:00.

00 11 * * * /path/to/fitsync/cron.sh

See your data

To view weight data on Google Fit,

  1. Choose "See graph details" for any day
  2. Choose "+ Add chart"
  3. Choose "Weight"
  4. Choose "Day", "Week", or "Month" to see the data for that time period

主要指标

概览
名称与所有者tantalor/fitsync
主编程语言Python
编程语言Python (语言数: 2)
平台
许可证
所有者活动
创建于2014-12-15 03:04:58
推送于2019-03-12 01:16:17
最后一次提交2016-05-31 11:02:19
发布数0
用户参与
星数70
关注者数13
派生数15
提交数41
已启用问题?
问题数8
打开的问题数5
拉请求数7
打开的拉请求数1
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?