Working versions
This commit is contained in:
parent
21376509ff
commit
2fb05d641b
2 changed files with 28 additions and 3 deletions
27
bettwaage-plotter/bett.py
Normal file
27
bettwaage-plotter/bett.py
Normal file
|
@ -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
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue