Skip to content

Commit

Permalink
Monarch Money cashflow sensor bugfix (#125774)
Browse files Browse the repository at this point in the history
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
  • Loading branch information
jeeftor and frenck committed Sep 27, 2024
1 parent ebfd442 commit bb73529
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions homeassistant/components/monarch_money/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -63,9 +63,13 @@ async def _async_setup(self) -> None:
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)
Expand Down

0 comments on commit bb73529

Please sign in to comment.