Add play button stub
This commit is contained in:
@@ -1,6 +1,21 @@
|
|||||||
|
from button_handler import ButtonHandler
|
||||||
|
import urequests as requests
|
||||||
from wifi import Wifi
|
from wifi import Wifi
|
||||||
from led import LED
|
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:
|
try:
|
||||||
LED_PIN = 2
|
LED_PIN = 2
|
||||||
SSID = "Proximus-Home-AA68_EXT"
|
SSID = "Proximus-Home-AA68_EXT"
|
||||||
@@ -13,5 +28,8 @@ try:
|
|||||||
wifi.connect()
|
wifi.connect()
|
||||||
|
|
||||||
led.on()
|
led.on()
|
||||||
|
|
||||||
|
button = ButtonHandler(14, send_request)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Unable to start", e)
|
print("Unable to start", e)
|
||||||
@@ -56,6 +56,11 @@ def start_party():
|
|||||||
print("Party started!")
|
print("Party started!")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@app.route("/command/party/play", methods=['POST'])
|
||||||
|
def start_party():
|
||||||
|
print("Move received !")
|
||||||
|
pass
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
try :
|
try :
|
||||||
|
|||||||
Reference in New Issue
Block a user