Requesting data from last seven days (#49485)

pull/49603/head
mariwing 2021-04-23 11:16:24 +02:00 committed by GitHub
parent 39cb22374d
commit 28a909c463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -774,8 +774,12 @@ class DataManager:
async def async_get_measures(self) -> dict[MeasureType, Any]:
"""Get the measures data."""
_LOGGER.debug("Updating withings measures")
now = dt.utcnow()
startdate = now - datetime.timedelta(days=7)
response = await self._hass.async_add_executor_job(self._api.measure_get_meas)
response = await self._hass.async_add_executor_job(
self._api.measure_get_meas, None, None, startdate, now, None, startdate
)
# Sort from oldest to newest.
groups = sorted(