Skip to content

Latest commit

 

History

History
112 lines (82 loc) · 5.25 KB

README.md

File metadata and controls

112 lines (82 loc) · 5.25 KB

Fitbit CLI

Release PyPI - Status PyPI - Version

This is not an official Fitbit CLI

Access your Fitbit data directly from your terminal 💻. View 💤 sleep logs, ❤️ heart rate, 🏋️‍♂️ activity levels, 🩸 SpO2, and more, all presented in a simple, easy-to-read table format!

Fitbit logo

asciicast

Supported Web APIs

Only GET APIs are supported!

API Status
User
Sleep
SpO2
Heart Rate Time Series
Active Zone Minutes (AZM) Time Series
Activity

Usage Guide

  1. Install the Fitbit CLI
python -m pip install fitbit-cli
  1. Help
fitbit-cli -h
usage: fitbit-cli [-h] [-i] [-s [DATE[,DATE]]] [-o [DATE[,DATE]]] [-e [DATE[,DATE]]] [-a [DATE[,DATE]]] [-u] [-v]

Fitbit CLI -- Access your Fitbit data at your terminal.

options:
  -h, --help            show this help message and exit
  -i, --init-auth       Initialize Fitbit iterative authentication setup
  -v, --version         Show fitbit-cli version

APIs:
  Specify date ranges (ISO 8601 format: YYYY-MM-DD) for the following arguments.
  You can provide a single date or a range (start,end). If not provided, defaults to today's date.

  -s, --sleep [DATE[,DATE]]
                        Show sleep data
  -o, --spo2 [DATE[,DATE]]
                        Show SpO2 data
  -e, --heart [DATE[,DATE]]
                        Show Heart Rate Time Series data
  -a, --active-zone [DATE[,DATE]]
                        Show Active Zone Minutes (AZM) Time Series data
  -u, --show-user-profile
                        Show user profile data
  1. Register Fitbit App

    1. Go to https://dev.fitbit.com/apps
    2. Click on "REGISTER AN APP" tab
    3. Follow below example and register an app

    Fitbit logo

  2. Run the following command to set up interactive authentication and store the Fitbit token locally

     fitbit-cli --init-auth

    For a visual guide, see the Asciinema recording below asciicast

  3. Start using it 😎

$ fitbit-cli -s
                                   Sleep Data Summary 😴
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Date 📆    ┃ Deep Sleep 🛏 ┃ Light Sleep 💤 ┃ REM Sleep 🌙 ┃ Wake Time ⏰ ┃ Efficiency 💯 ┃
┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ 2024-12-25 │ 139 min      │ 190 min        │ 155 min      │ 54 min       │ 55%           │
└────────────┴──────────────┴────────────────┴──────────────┴──────────────┴───────────────┘

NOTE: The token is valid for only 8 hours, fitbit-cli automatically refreshes the token when it expires.

Local Development

git clone [email protected]:veerendra2/fitbit-cli.git
cd fitbit-cli

python -m venv venv
source venv/bin/activate
python -m pip install -e .