mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use Local Timezone for Withings Integration (#98137)
This commit is contained in:
parent
abf065ed76
commit
5ed3e90607
@ -438,22 +438,16 @@ class DataManager:
|
|||||||
async def async_get_sleep_summary(self) -> dict[Measurement, Any]:
|
async def async_get_sleep_summary(self) -> dict[Measurement, Any]:
|
||||||
"""Get the sleep summary data."""
|
"""Get the sleep summary data."""
|
||||||
_LOGGER.debug("Updating withing sleep summary")
|
_LOGGER.debug("Updating withing sleep summary")
|
||||||
now = dt_util.utcnow()
|
now = dt_util.now()
|
||||||
yesterday = now - datetime.timedelta(days=1)
|
yesterday = now - datetime.timedelta(days=1)
|
||||||
yesterday_noon = datetime.datetime(
|
yesterday_noon = dt_util.start_of_local_day(yesterday) + datetime.timedelta(
|
||||||
yesterday.year,
|
hours=12
|
||||||
yesterday.month,
|
|
||||||
yesterday.day,
|
|
||||||
12,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
datetime.UTC,
|
|
||||||
)
|
)
|
||||||
|
yesterday_noon_utc = dt_util.as_utc(yesterday_noon)
|
||||||
|
|
||||||
def get_sleep_summary() -> SleepGetSummaryResponse:
|
def get_sleep_summary() -> SleepGetSummaryResponse:
|
||||||
return self._api.sleep_get_summary(
|
return self._api.sleep_get_summary(
|
||||||
lastupdate=yesterday_noon,
|
lastupdate=yesterday_noon_utc,
|
||||||
data_fields=[
|
data_fields=[
|
||||||
GetSleepSummaryField.BREATHING_DISTURBANCES_INTENSITY,
|
GetSleepSummaryField.BREATHING_DISTURBANCES_INTENSITY,
|
||||||
GetSleepSummaryField.DEEP_SLEEP_DURATION,
|
GetSleepSummaryField.DEEP_SLEEP_DURATION,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user