Get weight from Withings Health and update to Garmin Connect or Smashrun.
-
Download / clone the repository.
-
Satisfy the following requirements:
- Python 3.X
- Python libraries: arrow, requests, requests-oauthlib $ sudo pip3 install -r requirements.txt
-
Register an application with Withings Health and obtain a consumer key and secret.
- logo: the requirements are quite strict, feel free to use this one
- callback: you can pick anything, but if you want to do the automated authorization (you will be prompted for this), you need to pick the hostname/ip and port carefully. For example http://localhost:8087.
- localhost: if you run withings-weight-sync and do the authorization in the browser on the same device. This needs to be replaced by local or public ip/hostname if you run it on a server.
- 8087: a port that is likely not used by other services. For a remote setup make sure the port is not firewalled.
- http: https is available, but requires additional setup of certificates. For localhost http is fine.
-
On first run you need to set-up your Withings Health consumer key and secret:
./withings-weight-sync.py -k CONSUMER_KEY -s CONSUMER_SECRET setup withings
-
Follow the instructions on the screen and verify the application.
-
Register one or more destination services:
-
Garmin Connect: register your Garmin Connect credentials and sync your last measurement (provide GC password when asked):
./withings-weight-sync.py -k user@example.com setup garmin
-
Smashrun (implicit flow, recommended): for user level authentication simply copy the access token (no registration, no refresh after expiry):
./withings-weight-sync.py setup smashrun
-
Smashrun (code flow): register Smashrun API application keys and follow the authorization process to obtain your users refresh_token (registration required, refresh after expiry):
./withings-weight-sync.py -k CLIENT_ID -s CLIENT_SECRET setup smashrun_code
-
-
Verify that the relevant sections for the services are added to
config.ini
. -
Synchronize (new) measurements:
./withings-weight-sync.py sync garmin ./withings-weight-sync.py sync smashrun
Important Withings Health API, Smashrun API, and Garmin Connect credentials are stored in config.ini
. If this file is compromised your Garmin Connect account, personal health data from Withings Health, and activity data from Smashrun are at risk.
See ./withings-weight-sync.py --help
for more information.
withings-weight-sync includes components the following open-source projects:
fit.py
from ikasamah/withings-garmin, MIT License (c) 2013 Masayuki Hamasaki, adapted for Python 3.garmin.py
from jaroslawhartman/withings-garmin-v2, MIT License (c) 2013 Masayuki Hamasaki, adapted for Python 3.withings.py
from python-nokia, MIT License (c) 2012 Maxime Bouroumeau-Fuseau, 2017 ORCAS, unmodified.sessioncache.py
from cpfair/tapiriik, Apache License 2.0, unmodified.smashrun.py
from campbellr/smashrun-client, Apache License 2.0, several fixes.
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.