bettwaage-sidequest #2
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue