Package: health

All packages Open in Cursor /Users/friedrichstr/ai-mac-studio/development/health
Status
Description: Backend for all personal health data. Currently hosts the **Withings Body Scale** integration; additional health sources (activity, sleep, etc.) will live here too.
Port: —
Venv: venv present /Users/friedrichstr/ai-mac-studio/development/health/.venv/bin/python
Git: not a git repo
File tree
health/
  src/
    health/
  tests/
    test_withings.py
  pyproject.toml
  README.md
  uv.lock
Register Info
Status: recent
Components: tests
Documentation
Documentation
README

health

Backend for all personal health data. Currently hosts the Withings Body Scale integration; additional health sources (activity, sleep, etc.) will live here too.

Scope

The Withings scale has no local API — it syncs to the Withings cloud over WiFi, and you read it back through the Withings OAuth2 REST API. The health CLI wraps that flow.

Note: the scale's USB port is charging-only (no data interface), and firmware updates happen automatically over WiFi via the Withings phone app. Neither can be done from a Mac.

Installation

uv sync --extra test

Withings one-time setup

  1. Register an app at https://developer.withings.com to get a client_id and client_secret. Use a redirect URI such as http://localhost:1110/ (it only needs to be registered, not served).
  2. Export the credentials (or set them in .env):

bash export WITHINGS_CLIENT_ID='…' export WITHINGS_CLIENT_SECRET='…'

  1. Authorize once (opens a browser; paste the code from the redirect):

bash health authorize

Tokens are cached in withings_tokens.json and refreshed automatically.

Read measurements

health measure --db withings.sqlite
health latest --db withings.sqlite

measure fetches weight, fat ratio, fat mass, muscle mass, hydration, and bone mass (meastypes 1,6,8,76,77,88) and stores them in a small SQLite table (measurements(grpid, date, attribute, value)). Use --meastypes to change the set and --start/--end (Unix timestamps) to bound the history.

License

MIT

Recent commits
No git history.