02-12-2020 16:45
02-12-2020 16:45
We have been consistently seeing a difference in the total sleep minutes between the value showing in Fitbit App and the value returned by the API. What is the reason for this ?
{
"stages" : {
"deep" : 84,
"light" : 281,
"rem" : 92,
"wake" : 70
},
"totalMinutesAsleep" : 507,
"totalSleepRecords" : 1,
"totalTimeInBed" : 527,
"awakeCount" : 1,
"awakeDuration" : 4,
"awakeningsCount" : 14,
"dateOfSleep" : "2020-02-07",
"duration" : 31620000,
"efficiency" : 96,
"endTime" : "2020-02-07T07:51:00.000",
"isMainSleep" : true,
"logId" : 25792601434.0,
"minutesAfterWakeup" : 0,
"minutesAsleep" : 507,
"minutesAwake" : 20,
"minutesToFallAsleep" : 0,
"restlessCount" : 13,
"restlessDuration" : 16,
"startTime" : "2020-02-06T23:04:00.000",
"timeInBed" : 527,
"updatedAt" : ISODate("2020-02-06T23:07:48.424Z")
}
Answered! Go to the Best Answer.
02-14-2020 11:30
02-14-2020 11:30
I understand how the sleep stats can be confusing. We're hoping to update the documentation with more clarification. In the meantime, let see if information helps explain the data you're seeing.
The time, 7 hr and 37 mins, represents the time the person was asleep or in sleep stages deep, light and rem. The minutes you have in each sleep stage is
deep = 84
light = 281
rem = 92
wake = 70
If you add up all of these values, you'll receive 527 minutes which equals the total time in bed. The wake period represent the total time awake. This includes before & after you fall asleep, and any short wake periods that occur through out the night. If you sum the time in deep, rem or light together, OR subtract the wake from the total time in bed, you get 457 minutes (527 - 70 = 457). 457 minutes is 7 hr and 37 min.
Best,
Gordon
02-14-2020 11:30
02-14-2020 11:30
I understand how the sleep stats can be confusing. We're hoping to update the documentation with more clarification. In the meantime, let see if information helps explain the data you're seeing.
The time, 7 hr and 37 mins, represents the time the person was asleep or in sleep stages deep, light and rem. The minutes you have in each sleep stage is
deep = 84
light = 281
rem = 92
wake = 70
If you add up all of these values, you'll receive 527 minutes which equals the total time in bed. The wake period represent the total time awake. This includes before & after you fall asleep, and any short wake periods that occur through out the night. If you sum the time in deep, rem or light together, OR subtract the wake from the total time in bed, you get 457 minutes (527 - 70 = 457). 457 minutes is 7 hr and 37 min.
Best,
Gordon
02-15-2020 11:52
02-15-2020 11:52
Wonderful, so to put it short, the app displays the total time minus the wake time.
Thanks!
02-17-2020 20:25
02-17-2020 20:25
Thanks for the explanation, Gordon. However, what is the totalMinutesAsleep value indicating then? I can't figure out 507 from any of those values.
02-18-2020 13:59
02-18-2020 13:59
@developerGTC Can you PM me the following information so that I can investigate the values you are seeing for totalMinutesAsleep?
I may have the answer but I just need to confirm something before clarifying.
02-27-2020 15:00
02-27-2020 15:00
@developerGTC Thanks for sending me that information through PM, and I can see what the issue is here.
Based on the endpoint you used, it appears that you are using a deprecated sleep endpoint that is no longer supported. We now use v1.2 for sleep endpoints as this now includes a new algorithm to calculate sleep stages. I recommend making the changes in your application to call the new version of the sleep endpoints to see the correct totals.
For example, when I use the v1.2 sleep endpoint to fetch your sleep data from 2020-02-07 (the one showing 507 totalMinutesAsleep), I get this response:
},
"logId": 25792601434,
"minutesAfterWakeup": 0,
"minutesAsleep": 457,
"minutesAwake": 70,
"minutesToFallAsleep": 0,
"startTime": "2020-02-06T23:04:00.000",
"timeInBed": 527,
"type": "stages"
}
],
"summary": {
"stages": {
"deep": 84,
"light": 281,
"rem": 92,
"wake": 70
},
"totalMinutesAsleep": 457,
"totalSleepRecords": 1,
"totalTimeInBed": 527
}
}
Whereas the deprecated v1 endpoint will show:
"minutesAfterWakeup":0,"minutesAsleep":507,"minutesAwake":20,"minutesToFallAsleep":0,"restlessCount":13,"restlessDuration":16,"startTime":"2020-02-06T23:04:00.000","timeInBed":527}],"summary":{"stages":{"deep":84,"light":281,"rem":92,"wake":70},"totalMinutesAsleep":507,"totalSleepRecords":1,"totalTimeInBed":527}}
As you can see between the two responses, there are different totals due to the new algorithm implemented for sleep stages.
I hope this clears up any confusion. Please let me know if you have any additional questions.
03-27-2020 03:35
03-27-2020 03:35
Had the same trouble and couldn't understand why. Thanks for explanation either