From a2aa80804e1dbcae07736649f769fa029c133ad7 Mon Sep 17 00:00:00 2001 From: "ishak jmilou.ishak" Date: Thu, 9 Jan 2025 12:47:39 +0100 Subject: [PATCH] fix: move mqtt_client.on_message assignment under function definition --- src/Python/flask/web/app.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Python/flask/web/app.py b/src/Python/flask/web/app.py index f69355f..60741f8 100644 --- a/src/Python/flask/web/app.py +++ b/src/Python/flask/web/app.py @@ -24,6 +24,9 @@ mqtt_client.connect("localhost", 1884, 60) mqtt_client.loop_start() mqtt_client.subscribe("kobuki/data") +mqtt_client.on_message = on_message # this line needs to be under the function definition otherwise it can't find which function it needs to use + + # Database connectie-functie def get_db(): if 'db' not in g: # 'g' is specifiek voor een request en leeft zolang een request duurt