Monarch Money cashflow sensor bugfix (#125774)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
pull/126995/head
Jeef 2024-09-27 01:18:37 -06:00 committed by GitHub
parent bcfdfe93f9
commit 76858f0534
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 2 deletions

View File

@ -2,7 +2,7 @@
import asyncio
from dataclasses import dataclass
from datetime import timedelta
from datetime import datetime, timedelta
from aiohttp import ClientResponseError
from gql.transport.exceptions import TransportServerError
@ -63,9 +63,13 @@ class MonarchMoneyDataUpdateCoordinator(DataUpdateCoordinator[MonarchData]):
async def _async_update_data(self) -> MonarchData:
"""Fetch data for all accounts."""
now = datetime.now()
account_data, cashflow_summary = await asyncio.gather(
self.client.get_accounts_as_dict_with_id_key(),
self.client.get_cashflow_summary(),
self.client.get_cashflow_summary(
start_date=f"{now.year}-01-01", end_date=f"{now.year}-12-31"
),
)
return MonarchData(account_data=account_data, cashflow_summary=cashflow_summary)