mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
wrote message and connect function for the mqtt connection to pi
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from flask import Flask, render_template
|
||||
from flask import Flask, request, render_template
|
||||
import paho.mqtt.publish as publish
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -6,12 +7,11 @@ app = Flask(__name__)
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/control', methods=['POST'])
|
||||
def control():
|
||||
return("hello")
|
||||
|
||||
@app.route('/move', methods=['POST'])
|
||||
def move():
|
||||
direction = request.form['direction']
|
||||
publish.single("home/commands", direction, hostname="ishak.ishakpi.ddns.net")
|
||||
return "Message sent"
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
|
||||
|
||||
app.run(debug=True)
|
Reference in New Issue
Block a user