mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
fixed error
This commit is contained in:
@@ -12,13 +12,12 @@ mqtt_client.loop_start()
|
|||||||
|
|
||||||
@app.route('/', methods=['GET', 'POST'])
|
@app.route('/', methods=['GET', 'POST'])
|
||||||
def index():
|
def index():
|
||||||
|
message = ''
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
direction = request.form['direction']
|
direction = request.form['direction']
|
||||||
result = mqtt_client.publish("home/commands", direction)
|
result = mqtt_client.publish("home/commands", direction)
|
||||||
if result.rc == mqtt.MQTT_ERR_SUCCESS:
|
if result.rc == mqtt.MQTT_ERR_SUCCESS:
|
||||||
message = "Bericht succesvol gepubliceerd"
|
message = "Bericht succesvol gepubliceerd"
|
||||||
else:
|
|
||||||
message = "Fout bij het publiceren van bericht"
|
|
||||||
return render_template('index.html', message=message)
|
return render_template('index.html', message=message)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user