My app has been getting reports of a rather curious bug. If a user has a Pebble connected to Google Fit, the AGGREGATE_ACTIVITY_SUMMARY "sleep" value that the Fit API returns is the Pebble's total sleep minus its deep sleep value. So what a user would see on the various apps:
- Pebble: 7h55m sleep = 5h38m (regular sleep) + 2h17m (deep sleep)
- Google Fit: 7h55m sleep
- My app: 5h38m
To deal with this, my first idea was to just have: total sleep = sleeping (activity type 72) + deep sleep (activity type 110). However, the impression that I've gotten is that the sleeping activity type is a superset of light sleep, deep sleep, and rem sleep; if I just added sleeping with deep sleep it would over-count for other apps.
That said, the documentation (and 3rd-party writing) on the relationship between the sleep activity types isn't clear, so I could be wrong. Clearly the Google Fit app is doing the right thing and I'm not. Any information on the rules here (or places to look) would be superb. Thanks so much!
The fit API has following types
Fit platform provides those options as each device may track sleep differently. i.e one device will track sleep in total, or some other device may track sleep segregating into different buckets.
I believe pebble is tracking and storing the sleep data against SLEEP(72) and SLEEP_DEEP (110) for "regular sleep" and "deep sleep" respectively. So when fit api is queried against SLEEP (72), you are getting only that value.
In Fit application, sleep component is sum of all above i.e SLEEP, SLEEP_LIGHT, SLEEP_DEEP, SLEEP_REM.