Git Product home page Git Product logo

public-fitbit-projects's Introduction

Fitbit Fetch script and InfluxDB V2 Grafana integration

A script to fetch data from Fitbit servers using their API and store the data in a local influxdb database.

Setup instructions

  1. Create a new influxdb v2 bucket and token
  2. Install grafana if not already available
  3. Install python dependencies (within a venv if required): python3 -m pip install -r requirements.txt
  4. Create a fitbit application using the fitbit getting started guide
    • Many fields can be filled in arbitrarily. However the "OAuth 2.0 Application Type" must be set to personal and the "Redirect URL" needs to be http://localhost:4444 (the port number can be changed. Ensure its updated in the .env file as well)
  5. Edit the .env file with the required settings
  6. On a computer with a web browser, run the token-helper.py script. This will generate the inital refresh token and saved to the given file path. A web browser is required for the OAuth authorization
    • If the intent is to run this script on a headless server, copy the resulting token file to the server
  7. Add the influx database as a datasource in Grafana (if required)
  8. Install these two panel plugins
    1. Hourly heatmap
    2. Discrete
  9. Import the Health Stats Dashboard.json dashboard into grafana. Change the datasource to your influx database and alter the bucket variable (located at the top of the dashboard after importing) to the previously created bucket

You can use the Fitbit_Fetch_Autostart.service template to set up an auto-starting ( and auto-restarting in case of temporary failure ) service in Linux based system ( or WSL )

Usage

Run the script; if the token file does not exist, the script will request a refresh token as input and then will set up the token file. You can check the logs to see the work in progress. The script, by default, keeps running forever, calling different functions at scheduled intervals.

Dashboard Example

Dashboard

public-fitbit-projects's People

Contributors

aman207 avatar arpanghosh8453 avatar

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.