From 6999a674d526872a95f8ee481c3d08ece96cd1c0 Mon Sep 17 00:00:00 2001 From: Yashar Dabiran Date: Wed, 12 Feb 2025 09:22:02 -0500 Subject: [PATCH] Avoid sending updates to trmnl if the shopping list hasn't changed] --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index 7ba6e93..4564b10 100644 --- a/main.py +++ b/main.py @@ -18,6 +18,7 @@ class BringPlugin: self.email = os.getenv('EMAIL') self.password = os.getenv('PASSWORD') self.webhook_url = os.getenv('WEBHOOK_URL') + self.items = [] async def grabItems(self): itemObjs = (await self.bring.get_list(self.list)).items.purchase @@ -26,6 +27,12 @@ class BringPlugin: return items async def sendItemsToTerminal(self, session, items): + if set (self.items) == set(items): + print(f"The items list hasn't changed since the last fetch.") + print(f"Skipping sending updates to TRMNL.") + return + self.items = items + try: await session.post( self.webhook_url,