Sleep and Time Tracking Data Flow

Overview

This post should hopefully tie in what I do with my sleep tacking data and time tracking. It’s more complicated than it needs to be but automation and integration is still maturing with a large split between business focused (Zapier and Microsoft Flow) and consumer (IFTTT).

The aim of this to get the sleep duration and log the time into a time tracker.

Data Sources

I use the Withins app with the sleep mat as a data source because it has start and end times for each sleep activity. The downside to this data source is there is a delay because it only triggers on a daily basis and pushes all the sleep data at once. This is different from when you go to sleep which triggers when the sleep mat detects someone getting into bed and does not have the end date/time.

Sleep as Android would be my preferred data source however the Sleep as Android cloud sync only contains the start date and time so I can’t add the data to Toggl.

Data flow

Sleep data and timer data flow

As you can see form the above, it’s not a simple data mapping of start and end date time. I’ve had to use two automation flow and 3 services to achieve what I want.

Withings Health

The app captures the sleep data from the sleep mat on Nokia’s server. You need an account so it can be linked to IFTTT.

IFTTT

Fortunately, Withings Sleep has integration on IFTTT so it’s as simple as connecting to your account and setting up a trigger. The trigger is called “Export my last sleep data” and then “Add row to spreadsheet” in Google Sheets.

IFTTT fortunately unfortunately displays dates in a human readable format rather than a computer format. Further down the line, Toggl uses the ISO 8601 date formats as YYYY-MM-ddTHH:mm:ss e.g

I have copied the “Formatted row” to a text file so you can copy and paste all the available fields and tweak where needed.

Zapier

Create a new zap for a “New Spreadhseet Row” in Google Sheets. The next step is to create a time entry in Toggl using specific columns in the newly inserted row.
Zapier Google sheet to Toggl zap

To get the zap, click here.

Summary

Withings only provide the sleep data once per day so if you miss it, you’re out of luck. Also this introduces a day lag in your recorded timers.

It seems needlessly complicated but shows how integrations are better when they are open. Also these are freemium services so there if you’re using more than the free tier I’m afraid it will cost to do this.

Sleeping accounts for 1/3 of my day and happens daily so it saves a lot of time and putting this data in manually.

More on what I do with the data later.

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Blog, Software and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.