From 29e119560da76205cb24aa41189e7746b2b87b4e Mon Sep 17 00:00:00 2001 From: derlole <122916573+derlole@users.noreply.github.com> Date: Tue, 6 May 2025 15:38:55 +0000 Subject: [PATCH] e --- routes/esp_routes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/routes/esp_routes.py b/routes/esp_routes.py index 2454a69..3674228 100644 --- a/routes/esp_routes.py +++ b/routes/esp_routes.py @@ -32,9 +32,10 @@ def esp_online(): @esp.route('/toggle-machine', methods=['GET']) def toggle_machine(): + print("ESP: toggle-machine") randID = random.randint(1000, 9999) fullCommand = {'command': 'toggle_machine', 'status': 'pending', 'command_id': randID} - + print("ESP: toggle-machine 1") conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() @@ -45,10 +46,10 @@ def toggle_machine(): conn.commit() conn.close() - + print("ESP: toggle-machine 2") client = mqtt.Client() client.connect(MQTT_BROKER, MQTT_PORT, 60) client.publish(MQTT_TOPIC, json.dumps(fullCommand)) client.disconnect() - + print("ESP: toggle-machine 3") return jsonify({"status": json.dumps(fullCommand)}) \ No newline at end of file