From 1299c27284a2447db23eb5ea3c0d2ac9bdb287ea Mon Sep 17 00:00:00 2001 From: Laurent Date: Wed, 31 Dec 2025 00:10:27 +0100 Subject: [PATCH] Add play button stub --- esp32-wifi/main.py | 18 ++++++++++++++++++ rpi/main.py | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/esp32-wifi/main.py b/esp32-wifi/main.py index 88f6675c..7b317eaf 100644 --- a/esp32-wifi/main.py +++ b/esp32-wifi/main.py @@ -1,6 +1,21 @@ +from button_handler import ButtonHandler +import urequests as requests from wifi import Wifi from led import LED +def send_request(): + try: + print("Action triggered") + r = requests.post( + "http://192.168.15.119/command/party/play", + headers={ + "Authorization": "Bearer 0eed89e8-7625-4f8d-bf2a-0872aede0efb" + } + ) + r.close() + except Exception as ex: + print("Failed to trigger action", ex) + try: LED_PIN = 2 SSID = "Proximus-Home-AA68_EXT" @@ -13,5 +28,8 @@ try: wifi.connect() led.on() + + button = ButtonHandler(14, send_request) + except Exception as e: print("Unable to start", e) \ No newline at end of file diff --git a/rpi/main.py b/rpi/main.py index aab911e6..da8297c2 100644 --- a/rpi/main.py +++ b/rpi/main.py @@ -56,6 +56,11 @@ def start_party(): print("Party started!") pass +@app.route("/command/party/play", methods=['POST']) +def start_party(): + print("Move received !") + pass + if __name__ == "__main__": try :