mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Sort Withings sleep data on end date (#103454)
* Sort Withings sleep data on end date * Sort Withings sleep data on end date
This commit is contained in:
parent
5eba6dbc9f
commit
52736c6039
@ -147,7 +147,10 @@ class WithingsSleepDataUpdateCoordinator(
|
|||||||
)
|
)
|
||||||
if not response:
|
if not response:
|
||||||
return None
|
return None
|
||||||
return response[0]
|
|
||||||
|
return sorted(
|
||||||
|
response, key=lambda sleep_summary: sleep_summary.end_date, reverse=True
|
||||||
|
)[0]
|
||||||
|
|
||||||
|
|
||||||
class WithingsBedPresenceDataUpdateCoordinator(WithingsDataUpdateCoordinator[None]):
|
class WithingsBedPresenceDataUpdateCoordinator(WithingsDataUpdateCoordinator[None]):
|
||||||
|
@ -1,43 +1,4 @@
|
|||||||
[
|
[
|
||||||
{
|
|
||||||
"id": 2081804182,
|
|
||||||
"timezone": "Europe/Paris",
|
|
||||||
"model": 32,
|
|
||||||
"model_id": 63,
|
|
||||||
"hash_deviceid": "201d0b9a0556d6b755166b2cf8d22d3bdf0487ee",
|
|
||||||
"startdate": 1618691453,
|
|
||||||
"enddate": 1618713173,
|
|
||||||
"date": "2021-04-18",
|
|
||||||
"data": {
|
|
||||||
"wakeupduration": 3060,
|
|
||||||
"wakeupcount": 1,
|
|
||||||
"durationtosleep": 540,
|
|
||||||
"remsleepduration": 2400,
|
|
||||||
"durationtowakeup": 1140,
|
|
||||||
"total_sleep_time": 18660,
|
|
||||||
"sleep_efficiency": 0.86,
|
|
||||||
"sleep_latency": 540,
|
|
||||||
"wakeup_latency": 1140,
|
|
||||||
"waso": 1380,
|
|
||||||
"nb_rem_episodes": 1,
|
|
||||||
"out_of_bed_count": 0,
|
|
||||||
"lightsleepduration": 10440,
|
|
||||||
"deepsleepduration": 5820,
|
|
||||||
"hr_average": 103,
|
|
||||||
"hr_min": 70,
|
|
||||||
"hr_max": 120,
|
|
||||||
"rr_average": 14,
|
|
||||||
"rr_min": 10,
|
|
||||||
"rr_max": 20,
|
|
||||||
"breathing_disturbances_intensity": 9,
|
|
||||||
"snoring": 1080,
|
|
||||||
"snoringepisodecount": 18,
|
|
||||||
"sleep_score": 37,
|
|
||||||
"apnea_hypopnea_index": 9
|
|
||||||
},
|
|
||||||
"created": 1620237476,
|
|
||||||
"modified": 1620237476
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"id": 2081804265,
|
"id": 2081804265,
|
||||||
"timezone": "Europe/Paris",
|
"timezone": "Europe/Paris",
|
||||||
@ -77,6 +38,45 @@
|
|||||||
"created": 1620237480,
|
"created": 1620237480,
|
||||||
"modified": 1620237479
|
"modified": 1620237479
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": 2081804182,
|
||||||
|
"timezone": "Europe/Paris",
|
||||||
|
"model": 32,
|
||||||
|
"model_id": 63,
|
||||||
|
"hash_deviceid": "201d0b9a0556d6b755166b2cf8d22d3bdf0487ee",
|
||||||
|
"startdate": 1618691453,
|
||||||
|
"enddate": 1618713173,
|
||||||
|
"date": "2021-04-18",
|
||||||
|
"data": {
|
||||||
|
"wakeupduration": 3060,
|
||||||
|
"wakeupcount": 1,
|
||||||
|
"durationtosleep": 540,
|
||||||
|
"remsleepduration": 2400,
|
||||||
|
"durationtowakeup": 1140,
|
||||||
|
"total_sleep_time": 18660,
|
||||||
|
"sleep_efficiency": 0.86,
|
||||||
|
"sleep_latency": 540,
|
||||||
|
"wakeup_latency": 1140,
|
||||||
|
"waso": 1380,
|
||||||
|
"nb_rem_episodes": 1,
|
||||||
|
"out_of_bed_count": 0,
|
||||||
|
"lightsleepduration": 10440,
|
||||||
|
"deepsleepduration": 5820,
|
||||||
|
"hr_average": 103,
|
||||||
|
"hr_min": 70,
|
||||||
|
"hr_max": 120,
|
||||||
|
"rr_average": 14,
|
||||||
|
"rr_min": 10,
|
||||||
|
"rr_max": 20,
|
||||||
|
"breathing_disturbances_intensity": 9,
|
||||||
|
"snoring": 1080,
|
||||||
|
"snoringepisodecount": 18,
|
||||||
|
"sleep_score": 37,
|
||||||
|
"apnea_hypopnea_index": 9
|
||||||
|
},
|
||||||
|
"created": 1620237476,
|
||||||
|
"modified": 1620237476
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": 2081804358,
|
"id": 2081804358,
|
||||||
"timezone": "Europe/Paris",
|
"timezone": "Europe/Paris",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user