-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (23 loc) · 903 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import (render_template, Flask, request)
import os
import numpy
from controllers import modbus_utils as modbus
images_Folder = os.path.join('static', 'images')
app = Flask(__name__)
@app.route('/')
def index():
return render_template("layout.html")
@app.route("/api")
def posts():
global values
modbus.write_register(0, int(request.args.get(
"roundSliderData")), 1) if request.args.get("roundSliderData") else None
modbus.write_register(1, int(request.args.get(
"writeRegister")), 1) if request.args.get("writeRegister") else None
modbus.write_register(2, int(request.args.get("data").strip(
'%')), 1) if request.args.get("data") else None
modbus.write_register(3, int(request.args.get("power")),
1) if request.args.get("power") else None
return '', 204
if __name__ == '__main__':
app.run(debug=True)