bettwaage-sidequest #2

Merged
m.giller merged 38 commits from bettwaage-sidequest into master 2024-06-07 23:38:56 +02:00
Showing only changes of commit 78a5b3d8ca - Show all commits

View file

@ -93,7 +93,7 @@ def check_for_change():
# Make sure there is a bed_weight
global empty_weight
if empty_weight is None:
clusters = get_clusters(local_history)
clusters = get_clusters([d["total"] for d in local_history])
empty_weight = min([median(cluster) for cluster in clusters.values()])
# Determine number of people
@ -124,9 +124,7 @@ def add_weights_to_log(tl: float, tr: float, bl: float, br: float):
timestamp = datetime.now()
global local_history
local_history.append(
{"tl": tl, "tr": tr, "bl": bl, "br": br, "total": total, "timestamp": timestamp}
)
local_history.append({"tl": tl, "tr": tr, "bl": bl, "br": br, "total": total})
if len(local_history):
local_history = local_history[len(local_history) - history_max_length :]