A script to fetch data from Fitbit servers using their API and store the data in a local influxdb database.
❗❗ The Fitbit application must be personal type for the access of intraday data series ❗❗
docker pull thisisarpanghosh/fitbit-fetch-data:latest && docker compose run --rm fitbit-fetch-data
docker compose up -d
( to launch the full stack )version: '3.4'
services:
fitbit-fetch-data:
restart: unless-stopped
image: thisisarpanghosh/fitbit-fetch-data:latest
container_name: fitbit-fetch-data
volumes:
- ./logs:/app/logs # logs folder should exist and owned by user id 1000
- ./tokens:/app/tokens # tokens folder should exist and owned by user id 1000
- /etc/timezone:/etc/timezone:ro
environment:
- FITBIT_LOG_FILE_PATH=/app/logs/fitbit.log
- TOKEN_FILE_PATH=/app/tokens/fitbit.token
- OVERWRITE_LOG_FILE=True
- INFLUXDB_VERSION=1 # supported values are 1 and 2
# Variables for influxdb 2.x ( you need to change the influxdb container config below accordingly )
- INFLUXDB_BUCKET=your_bucket_name_here # for influxdb 2.x
- INFLUXDB_ORG=your_org_here # for influxdb 2.x
- INFLUXDB_TOKEN=your_token_here # for influxdb 2.x
- INFLUXDB_URL=your_influxdb_server_location_with_port_here # for influxdb 2.x
# Variables for influxdb 1.x
- INFLUXDB_HOST=influxdb # for influxdb 1.x
- INFLUXDB_PORT=8086 # for influxdb 1.x
- INFLUXDB_USERNAME=fitbit_user # for influxdb 1.x
- INFLUXDB_PASSWORD=fitbit_password # for influxdb 1.x
- INFLUXDB_DATABASE=fitbit_database # for influxdb 1.x
- CLIENT_ID=your_application_client_ID # Change this to your client ID
- CLIENT_SECRET=your_application_client_secret # Change this to your client Secret
- DEVICENAME=Your_Device_Name # Change this to your device name - e.g. "Charge5"
- LOCAL_TIMEZONE=Automatic # set to "Automatic" for Automatic setup from User profile (if not mentioned here specifically).
influxdb:
restart: unless-stopped
container_name: influxdb
environment:
- INFLUXDB_DB=fitbit_database
- INFLUXDB_USER=fitbit_user
- INFLUXDB_USER_PASSWORD=fitbit_password
ports:
- '8086:8086'
volumes:
- './influxdb:/var/lib/influxdb'
image: 'influxdb:1.8'
grafana:
restart: unless-stopped
volumes:
- './grafana:/var/lib/grafana'
ports:
- '3000:3000'
container_name: grafana
image: 'grafana/grafana:latest'