27 lines
780 B
Python
27 lines
780 B
Python
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
|