From 76315649f7a747616c61c0f3bc515f1068644761 Mon Sep 17 00:00:00 2001 From: "ishak jmilou.ishak" Date: Wed, 23 Oct 2024 14:32:03 +0200 Subject: [PATCH] Refactor move function to publish direction from request form --- src/Python/flask/web/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Python/flask/web/app.py b/src/Python/flask/web/app.py index ba28f0b..057a902 100644 --- a/src/Python/flask/web/app.py +++ b/src/Python/flask/web/app.py @@ -15,7 +15,8 @@ def index(): @app.route('/move', methods=['POST']) 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: print("Bericht succesvol gepubliceerd") else: