From 35443b7cc8f75bf9dd8f690f9b1c6909ed365203 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Tue, 7 May 2024 00:04:31 +0200 Subject: [PATCH] Added sanity check to clean up data --- src/endpoints/handlers/bett.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/endpoints/handlers/bett.py b/src/endpoints/handlers/bett.py index 80cec89..fd07f9e 100644 --- a/src/endpoints/handlers/bett.py +++ b/src/endpoints/handlers/bett.py @@ -153,8 +153,13 @@ async def log_bed_weights(): bl = r.get(f"{bett_ip}/sensor/bl/").json()["value"] br = r.get(f"{bett_ip}/sensor/br/").json()["value"] + # Sanity check + if min([tl, tr, bl, br]) <= 0: + continue + add_weights_to_log(tl, tr, bl, br) check_for_change() except Exception as ex: logging.exception(ex) - await asyncio.sleep(1) + finally: + await asyncio.sleep(1)