From bb73529770ee20ecca0b812c2bb34d9c8579b5d8 Mon Sep 17 00:00:00 2001 From: Jeef Date: Fri, 27 Sep 2024 01:18:37 -0600 Subject: [PATCH] Monarch Money cashflow sensor bugfix (#125774) Co-authored-by: Franck Nijhof --- homeassistant/components/monarch_money/coordinator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/monarch_money/coordinator.py b/homeassistant/components/monarch_money/coordinator.py index 8eb15d448ecc94..3e689c48e91f16 100644 --- a/homeassistant/components/monarch_money/coordinator.py +++ b/homeassistant/components/monarch_money/coordinator.py @@ -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 @@ 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)