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