diff --git a/bettwaage-plotter/bett.py b/bettwaage-plotter/bett.py new file mode 100644 index 0000000..2e40e9e --- /dev/null +++ b/bettwaage-plotter/bett.py @@ -0,0 +1,27 @@ +import requests as r +from time import sleep + +bett_ip = "http://192.168.178.110:80" +mash_ip = "http://192.168.178.84:9587" + +while True: + try: + tl = r.get(f"{bett_ip}/sensor/tl/").json()["value"] + tr = r.get(f"{bett_ip}/sensor/tr/").json()["value"] + br = r.get(f"{bett_ip}/sensor/br/").json()["value"] + + print(f"tl = {tl}") + print(f"tr = {tr}") + # print(f"tl = {tl}") + print(f"br = {br}") + print("==========") + print(f"total = {tl + tr + br * 2}") + print("==========") + + s = r.post(f"{mash_ip}/bettwaage/add?tl={int(tl * 1000)}&tr={int(tr * 1000)}&bl={int(br * 1000)}&br={int(br * 1000)}") + + sleep(1) + except KeyboardInterrupt: + exit() + except: + pass diff --git a/bettwaage-plotter/main.py b/bettwaage-plotter/main.py index abff5be..afc6dde 100644 --- a/bettwaage-plotter/main.py +++ b/bettwaage-plotter/main.py @@ -24,7 +24,7 @@ br = [d["br"] for d in data] fig, ax1 = plt.subplots() -color = "tab:red" +color = "tab:blue" ax1.set_xlabel("time (s)") ax1.set_ylabel("Total", color=color) ax1.plot(x, total, color=color) @@ -40,5 +40,3 @@ ax2.plot(x, br, color="tab:orange") fig.tight_layout() # otherwise the right y-label is slightly clipped plt.show() - -plt.show()