{"id":17114114,"url":"https://github.com/horihiro/node-fitbit-livedata","last_synced_at":"2025-04-13T04:01:46.969Z","repository":{"id":57237534,"uuid":"102655538","full_name":"horihiro/node-fitbit-livedata","owner":"horihiro","description":"This  project aims to getting `livedata` from Fitbit tracker, is unofficial and experimental.","archived":false,"fork":false,"pushed_at":"2017-12-19T06:42:29.000Z","size":2792,"stargazers_count":11,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-07T22:09:21.289Z","etag":null,"topics":["fitbit","fitbit-tracker","livedata","node-fitbit-livedata","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/horihiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-06T20:32:37.000Z","updated_at":"2024-12-27T20:32:30.000Z","dependencies_parsed_at":"2022-08-26T14:04:16.413Z","dependency_job_id":null,"html_url":"https://github.com/horihiro/node-fitbit-livedata","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fnode-fitbit-livedata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fnode-fitbit-livedata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fnode-fitbit-livedata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horihiro%2Fnode-fitbit-livedata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/horihiro","download_url":"https://codeload.github.com/horihiro/node-fitbit-livedata/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661706,"owners_count":21141450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fitbit","fitbit-tracker","livedata","node-fitbit-livedata","nodejs"],"created_at":"2024-10-14T17:15:15.445Z","updated_at":"2025-04-13T04:01:46.920Z","avatar_url":"https://github.com/horihiro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-fitbit-livedata\nThis project aims to getting `livedata` from Fitbit tracker\n\n## !!! CAUTION !!!\nThis is an **UNOFFICIAL** and **EXPERIMENTAL** module.\n\nUsing this module sometimes forcibly logs out from fitbit application on your mobile device.\n\n## Requirement\n- Host Machine\n  - macOS El Capitan\n  - Windows10 Creators Update or later\n  - Raspbian 4.9\n- Runtime\n  - node.js (v6 or later)\n  - Java (v1.8.0 or later)\n- Fitbit Account\n- Fitbit Tracker(Device) registered in the above account\n  - Supported Trackers are\n    - Charge HR\n  \n    The following trackers are not supported yet.\n    - Ionic\n\n    The following trackers are not verified yet.\u003cbr\u003e\n    \\# I don't have them\n    - Charge 2\n    - Alta HR\n    - Blaze\n    - Flyer\n    - Flex 2\n    - Surge\n    - Charge\n    - Flex\n    - One\n    - Zip\n    - Ultra\n    - Force\n    - Aria 2\n\n## Remarks\n### for Mac\nUsing this module on macOS, you need to connect or sync the macOS and your tracker with the [official application](https://www.fitbit.com/jp/setup?platform=mac10_5) **only once** before using this module.\n\n### for Windows\nBecause of using [noble-uwp](https://github.com/jasongin/noble-uwp) (it's very useful !), the version of your windows has to be Creators Update or later.\u003cbr\u003e\nAnd this module on Windows can't get heart rate from your trackers.\n\n### for Raspbian\nIf you want to get heart rate from your trackers, you need to comment out [the line](https://github.com/sandeepmistry/bleno/blob/master/lib/hci-socket/bindings.js#L137) in `node_modules/bleno/lib/hci-socket/bindings.js` ([bleno's issue](https://github.com/sandeepmistry/bleno/issues/326))\n\n### for Trackers\nSome trackers need to be set `On` or `Auto` about heart rate using FItbit app for a smartphone, and sync after that.\n\n## Install\n### Install as library\nDo `npm install`(or `npm i`) in your project directory.\n```sh\n$ cd /path/to/your/project/\n$ npm i fitbit-livedata\n```\n\nAfter `npm install`, you can see this module in `dependencies` of your `package.json`, the key is `fitbit-livedata` and the value is the path to `node-fitbit-livedata`.\n```sh\n$ cat /path/to/your/project/package.json\n{\n  \"name\": \"\u003cYOUR_`PROJECT_NAME\u003e\",\n    :\n  \"dependencies\": {\n    \"fitbit-livedata\": \"file:/path/to/node-fitbit-livedata\"\n  }\n}\n```\n\n### Install as CLI tool\n\n```sh\n$ npm i -g fitbit-livedata\n```\n\n## Usage\n\n### Usage as library\n\n```javascript\nimport fitbit from 'fitbit-livedata';\n\nfitbit.on('discover', (tracker) =\u003e {\n  tracker.on('connecting', () =\u003e {\n    console.log('connecting to the tracker');\n  });\n  tracker.on('openingSession', () =\u003e {\n    console.log('start tracker session');\n  });\n  tracker.on('authenticating', () =\u003e {\n    console.log('start tracker authentication process.');\n  });\n  tracker.on('sendAuth', () =\u003e {\n    console.log('send authention infomation.');\n  });\n  tracker.on('authenticated', () =\u003e {\n    console.log('finishing tracker authentication process...');\n  });\n  tracker.on('connected', () =\u003e {\n    console.log('tracker is connected.');\n\n    tracker.on('disconnected', () =\u003e {\n      console.log('tracker is disconnected.');\n      // if you want to re-connect automatically.\n      tracker.connect();    \n    });\n  });\n  tracker.on('data', (livedata) =\u003e {\n    process.stdout.write(`${JSON.stringify(livedata)}\\n`);\n  });\n  tracker.connect();\n});\nfitbit.on('error', (error) =\u003e {\n  console.error(`${error}\\n`);\n  process.exit(1);\n});\n\nconst accounts = [\n  {\n    username: fitbitUser1_Username,\n    password: fitbitUser1_Password\n  },\n  {\n    username: fitbitUser2_Username,\n    password: fitbitUser2_Password\n  },\n//  :\n];\nconst trackers = [];\n\naccounts.reduce((prev, curr) =\u003e {\n  return prev.then(() =\u003e {\n    return new Promise((resolve) =\u003e {\n      fitbit.getTrackers(curr)\n        .then((trackerInfos) =\u003e {\n          // login succeeded\n          trackerInfos.forEach((trackerInfo) =\u003e {\n            trackers.push(trackerInfo);\n          });\n          console.log(`${trackersInfos}\\n`);\n          resolve();\n        })\n        .catch((err) =\u003e {\n          // login failed\n          console.error(`login failed\\n`);\n          console.error(`${err}\\n`);\n          resolve();\n        });\n    });\n  });\n}, Promise.resolve()).then(() =\u003e {\n  fitbit.scanTrackers(trackers);\n});\n```\n\n### Usage as CLI tool\n\n```sh\n$ fitbit-livedata -u \u003cUSERNAME\u003e -p \u003cPASSWORD\u003e\n{\"device\":{\"name\":\"Charge HR\",\"address\":\"XX:XX:XX:XX:XX:XX\",\"serialNumber\":\"0123456789ab\"},\"livedata\":{\"time\":\"YYYY-MM-DDThh:mm:dd.sssZ\",\"steps\":5700,\"distance\":4024236,\"calories\":1220,\"elevation\":13,\"veryActive\":2,\"heartRate\":80}}\n{\"device\":{\"name\":\"Charge HR\",\"address\":\"XX:XX:XX:XX:XX:XX\",\"serialNumber\":\"0123456789ab\"},\"livedata\":{\"time\":\"YYYY-MM-DDThh:mm:dd.sssZ\",\"steps\":5700,\"distance\":4024236,\"calories\":1220,\"elevation\":13,\"veryActive\":2,\"heartRate\":82}}\n :\n```\n\nIf you want to connect to only one tracker, add the tracker name( e.g. \"Charge HR\") with `--trackername`/`-t` option.\n\n```sh\n$ fitbit-livedata -u \u003cUSERNAME\u003e -p \u003cPASSWORD\u003e -t \"Charge HR\"\n```\n\n## Memo\n### Sequence Diagram between host, tracker and fitbit.com\n![sequence.png](./sequence.png)\n\n[Japanese memo on Qiita](https://qiita.com/horihiro/items/03c4bef3e71539eddaad)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorihiro%2Fnode-fitbit-livedata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhorihiro%2Fnode-fitbit-livedata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorihiro%2Fnode-fitbit-livedata/lists"}