withings-exporter

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2020 License: MIT Imports: 11 Imported by: 0

README

Prometheus Exporter for the Withings Body Smart Scales

I have a Withings Body+ smart scale. And I wanted to build my first Prometheus exporter.

What this does

  • Outputs a gauge metric for withings_current_weight, taking the most recent recorded weight. The API returns the weight in kilograms.
  • Outputs a gauge metric for withings_current_hydration, taking the most recent recorded hydration level.
  • OAuth token refresh.
  • Metrics refresh after 30 minutes.
  • Customizable --metrics-port and --scrape-interval. See --help for default values.
  • Outputs all of the usual Go Prometheus client metrics.

Future plans

Running the exporter

cd /path/to/repo
go build .
./withings-exporter

or

cd /path/to/repo
go run main.go metrics.go types.go

--help output:

usage: withings-exporter [<flags>]

Flags:
  --help                  Show context-sensitive help (also try --help-long and
                          --help-man).
  --metrics-port=8080     The port to bind to for serving metrics
  --scrape-interval=1800  Time in seconds between scrapes

Authentication

  • Create a Withings account. (You should already have one if you have a Withings product and use the HealthMate app!)
  • Make a Withings API Application.
  • Set WITHINGS_APP_CLIENT_ID and WITHINGS_APP_CLIENT_SECRET based off that application you created.
  • Follow the instructions when you run the exporter to authorize your account to connect with the application. Access tokens are valid for three hours, then this auto-refreshes.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL