vangorra / python_withings_api

Library for the Withings Health API
MIT License
101 stars 34 forks source link

sleep summary data incomplete? #53

Closed ArjanM83 closed 3 years ago

ArjanM83 commented 3 years ago

I tried the example on the homepage, but changed the last two lines to receive the sleep summary data:

print(api.sleep_get_summary(startdateymd='2020-12-01', enddateymd='2020-12-05'))

The response I received is fine apart from some data that is missing, a snippet of the response:

GetSleepSummarySerie(timezone=tzfile('Europe/Amsterdam'), model=<SleepModel.SLEEP_MONITOR: 32>, startdate=<Arrow [2020-12-03T23:41:00+01:00]>, enddate=<Arrow [2020-12-04T10:12:00+01:00]>, date=<Arrow [2020-12-04T01:00:00+01:00]>, modified=<Arrow [2020-12-04T12:15:06+01:00]>, data=GetSleepSummaryData(breathing_disturbances_intensity=None, deepsleepduration=5640, durationtosleep=2640, durationtowakeup=1620, hr_average=None, hr_max=None, hr_min=None, lightsleepduration=18420, remsleepduration=7380, rr_average=None, rr_max=None, rr_min=None, sleep_score=None, snoring=None, snoringepisodecount=None, wakeupcount=4, wakeupduration=6420), id=1738096164)

I'm especially interested in retrieving the heart rate data (hr_max / hr_min / hr_average), but that part is missing. Snoring and sleepscore are missing as well. In my iOS app all of these metrics are shown for the past days, so the data should be available.

Am I doing something wrong in the retrieval of the data?

vangorra commented 3 years ago

I doubt you are doing anything wrong. Over the last few months, it appears Withings is returning incomplete data. The API provided by Withings is rather unreliable which often breaks things.

ArjanM83 commented 3 years ago

Withings replied and stated the data_fields parameter is missing in my call, when adding the parameter the data is correctly returned:

data_fields = [GetSleepSummaryField.HR_AVERAGE]
print(api.sleep_get_summary(startdateymd='2020-12-01', enddateymd='2020-12-05', data_fields=data_fields))