Skip to content

baptistebisson/withings-to-influxdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About The Project

I wanted to store and keep history of my scanwatch data in influxdb which is a nice and easy database to use with Grafana.

You could use the withings API, but it doesn't look really simple to use with the oauth system.

It's my first CLI app using GO. I choose this language to learn it, and it seems suitable for creating CLI app.

Supported data

  • steps
  • distance
  • heart

Built With

  • GO
  • InfluxDB

Grafana example

Query

Total per day.

from(bucket: "withings")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "steps")
  |> filter(fn: (r) => r["_field"] == "count")
  |> filter(fn: (r) => r["device"] == "scanwatch")
  |> aggregateWindow(every: 1d, fn: sum)
  |> yield(name: "total_steps")

Getting Started

Prerequisites

You need to retrieve withings data: https://support.withings.com/hc/en-us/articles/360001394948-Withings-App-Android-Downloading-my-data

You will receive an email, extract the archive and get the path of the folder

You also need an InfluxDB API endpoint available.

Installation

  • Clone
git clone https://github.com/baptistebisson/withings-to-influxdb.git
  • Setup env
cd withings-to-influxdb && cp .env.example .env
  • Run it
go run main.go --folder=/path/to/withings/export

Output example

Reading file /path/to/withings/export/raw_tracker_distance.csv
Found a total of 26286 records in CSV file
Going to write data to InfluxDB
Data successfully written to InfluxDB
Reading file /path/to/withings/export/raw_tracker_steps.csv
Found a total of 26286 records in CSV file
Going to write data to InfluxDB
Data successfully written to InfluxDB
Reading file /path/to/withings/export/raw_hr_hr.csv
Found a total of 186246 records in CSV file
Going to write data to InfluxDB
Data successfully written to InfluxDB

Withings doc

raw_tracker_steps.csv: Steps data

  • Duration : (seconds)
  • Value : (steps number)

sleep.csv: Sleep data

raw_tracker_distance.csv: Distance data

  • Duration : (seconds)
  • Value : (meters)

About

Save withings scanwatch data to influxdb

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages