bettwaage-sidequest #2
1 changed files with 13 additions and 17 deletions
|
@ -4,7 +4,7 @@ from datetime import datetime
|
|||
import json
|
||||
|
||||
|
||||
file_path = "history.json"
|
||||
file_path = None
|
||||
history_url = "http://192.168.178.84:9587/bettwaage/history"
|
||||
|
||||
convert_time_to_seconds = True
|
||||
|
@ -21,44 +21,40 @@ else:
|
|||
|
||||
|
||||
# Experiment: Solving for missing foot with known total weight
|
||||
bed_weight = 78290
|
||||
person_weight = 63000
|
||||
bed_weight = 81
|
||||
person_weight = 63
|
||||
known_total_weight = bed_weight + person_weight
|
||||
bed_only_weight = {}
|
||||
for d in data:
|
||||
if d["total"] == bed_weight:
|
||||
if d["total"] < bed_weight:
|
||||
bed_only_weight = {
|
||||
"tl": d["tl"],
|
||||
"tr": d["tr"],
|
||||
"bl": bed_weight - (d["tl"] + d["tr"] + d["br"]),
|
||||
"bl": d["bl"],
|
||||
"br": d["br"],
|
||||
}
|
||||
break
|
||||
|
||||
in_bed_data = None
|
||||
threshhold = 100000
|
||||
threshhold = 100.0
|
||||
min_length = 100
|
||||
skip = 0
|
||||
for d in data:
|
||||
t = d["total"]
|
||||
if t >= threshhold:
|
||||
if in_bed_data is None:
|
||||
in_bed_data = []
|
||||
in_bed_data.append(d)
|
||||
elif in_bed_data is not None:
|
||||
if len(in_bed_data) < min_length:
|
||||
elif in_bed_data is not None and len(in_bed_data) > 0:
|
||||
if skip > 0:
|
||||
in_bed_data = []
|
||||
skip -= 1
|
||||
elif len(in_bed_data) < min_length:
|
||||
in_bed_data = []
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
# Calculate bottom left
|
||||
for d in data:
|
||||
d["bl"] = known_total_weight - (d["br"] + d["tr"] + d["tl"])
|
||||
# Set known total weight
|
||||
d["total"] = known_total_weight
|
||||
|
||||
|
||||
data = in_bed_data
|
||||
# data = in_bed_data
|
||||
|
||||
|
||||
# Array data
|
||||
|
|
Loading…
Reference in a new issue