mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-03 20:04:58 +00:00
Refactor move function to publish direction from request form
This commit is contained in:
@@ -15,7 +15,8 @@ def index():
|
|||||||
|
|
||||||
@app.route('/move', methods=['POST'])
|
@app.route('/move', methods=['POST'])
|
||||||
def move():
|
def move():
|
||||||
result = mqtt_client.publish("home/commands", "Knop ingedrukt!")
|
direction = request.form['direction']
|
||||||
|
result = mqtt_client.publish("home/commands", direction)
|
||||||
if result.rc == mqtt.MQTT_ERR_SUCCESS:
|
if result.rc == mqtt.MQTT_ERR_SUCCESS:
|
||||||
print("Bericht succesvol gepubliceerd")
|
print("Bericht succesvol gepubliceerd")
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user