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 dc22afdfc8 - Show all commits

View file

@ -34,7 +34,7 @@ def get_clusters(data: list[float], min_delta: float) -> dict:
clusters = {} clusters = {}
for point in data: for point in data:
for known in clusters.keys(): for known in clusters.keys():
if math.abs(point - known) < min_delta: if math.fabs(point - known) < min_delta:
clusters[known].append(point) clusters[known].append(point)
continue continue
clusters[point] = [point] clusters[point] = [point]
@ -89,12 +89,10 @@ def check_for_change():
# Is triggered? # Is triggered?
delta = latest["total"] - local_history[-2]["total"] delta = latest["total"] - local_history[-2]["total"]
if math.abs(delta) < min_noticable_difference: if math.fabs(delta) < min_noticable_difference:
logging.info(f"Delta: {delta}")
return return
# Changed weight up or down? # Changed weight up or down?
logging.info(f"Delta: {delta}")
weight_increased = delta > 0 weight_increased = delta > 0
# Make sure there is a bed_weight # Make sure there is a bed_weight