From 1b5c73127e807955cba416c43d95e650da544a7a Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Mon, 6 May 2024 22:56:01 +0200 Subject: [PATCH] Added logging --- src/endpoints/handlers/bett.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/endpoints/handlers/bett.py b/src/endpoints/handlers/bett.py index e482472..1c66bdf 100644 --- a/src/endpoints/handlers/bett.py +++ b/src/endpoints/handlers/bett.py @@ -6,6 +6,7 @@ from statistics import median from typing import Optional import requests as r from ..hue import hue +import logging file_path: str = "bettwaage.csv" header: str = "timestamp;tl;tr;bl;br;total;\n" @@ -77,6 +78,7 @@ def is_capacity_reached() -> bool: def check_for_change(): # Check for capicity limits if is_capacity_reached(): + logging.info(f"Capacity reached") return global show_scale_countdown @@ -91,6 +93,7 @@ def check_for_change(): return # Changed weight up or down? + logging.info(f"Delta: {delta}") weight_increased = delta > 0 # Make sure there is a bed_weight @@ -98,9 +101,11 @@ def check_for_change(): if empty_weight is None: clusters = get_clusters([d["total"] for d in local_history]) empty_weight = min([median(cluster) for cluster in clusters.values()]) + logging.info(f"Empty weight: {empty_weight}") # Determine number of people number_of_people = round((latest["total"] - empty_weight) / average_person_weight) + logging.info(f"Number of people: {number_of_people}") if number_of_people == 1 and weight_increased: show_scale_countdown = 60 # Should be a multiple of 3