From 98c4aeeba1d01264db16229516b065af64f36536 Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 31 Dec 2025 00:37:57 +0100 Subject: [PATCH] Start filling routes stub --- rpi/main.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rpi/main.py b/rpi/main.py index 712af644..8acb3a55 100644 --- a/rpi/main.py +++ b/rpi/main.py @@ -2,7 +2,7 @@ import os from dotenv import load_dotenv -from flask import Flask +from flask import Flask, jsonify from hardware.light.lora_light_sensor_reader import LoraLightSensorReader from hardware.rfid.reader import RfidReader @@ -53,13 +53,21 @@ forward_service = ForwarderService(local_broker, api_broker) @app.route("/command/party/start", methods=['POST']) def start_party(): - print("Party started!") - pass + try: + print("Party started!") + return jsonify({"status": "ok", "message": "Party started"}), 200 + except Exception as ex: + print(e) + return jsonify({"status": "error", "message": f"An error occurred : {e}"}), 500 @app.route("/command/party/play", methods=['POST']) def party_play(): - print("Move received !") - pass + try: + print("Move received started!") + return jsonify({"status": "ok", "message": "Party started"}), 200 + except Exception as ex: + print(e) + return jsonify({"status": "error", "message": f"An error occurred : {e}"}), 500 if __name__ == "__main__":