Restructure LightbarServer; implement LightbarController

This commit is contained in:
Lexi / Zoe 2024-01-26 19:24:02 +01:00
parent 144e7d556f
commit 722abc3056
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
8 changed files with 76 additions and 39 deletions

View file

@ -0,0 +1,17 @@
import uasyncio
from microdot_asyncio import Microdot
rest_api = Microdot()
# TODO -- all of these responses aren't REST yet
@rest_api.post('/shutdown')
async def shutdown(request):
uasyncio.create_task(request.app.scheduled_shutdown())
return 'Shutting down!\n'
@rest_api.post('/reboot')
async def reboot(request):
uasyncio.create_task(request.app.scheduled_reboot())
return 'Rebooting now!\n'