/withings-exporter

prometheus exporter for Withings HealthCare(measurement, activity, sleep)

Primary LanguagePythonMIT LicenseMIT

withings-exporter

Badge ci

Prometheus exporter for Withings Health Mate (For Public Cloud).

Usage

Registration

At first, create withings app for yours.

Start(Docker)

The simplest way to use it is with Docker.

# set env
export WITHINGS_CLIENT_ID="YOURCRIENTID"
export WITHINGS_CONSUMER_SECRET="YOURCLIENTSECRET"

# run get_token.py
docker run -p 8000:8000 \
    --env WITHINGS_CLIENT_ID \
    --env WITHINGS_CONSUMER_SECRET \
    legnoh/withings-exporter python3 get_token.py

# paste your generated data to .env (and edit TZ)
vi .env

# run exporter(with above .env file)
docker run -p 8000:8000 \
    --env-file='.env' \
    legnoh/withings-exporter

Start(source)

Alternatively, it can be started from the source.

# clone
git clone https://github.com/legnoh/withings_exporter.git && cd withings_exporter
pipenv install

# prepare env file for your apps
cp example/example.env .env

# input WITHINGS_CLIENT_ID, WITHINGS_CONSUMER_SECRET
vi .env

# exec get_token.py(in your browser)
pipenv run get-token

# paste your env to .env 3rd block (and edit TZ)
vi .env

# run exporter
pipenv run main

Metrics

please check metrics.yml or example

Disclaim

  • This script is NOT authorized by Withings.
    • We are not responsible for any damages caused by using this script.
  • This script is not intended to overload these sites or services.
    • When using this script, please keep your posting frequency within a sensible range.