Implement shutdown and reboot via API; add Makefile for deployment
This commit is contained in:
parent
56e7a1d2de
commit
f16f506332
11 changed files with 124 additions and 14 deletions
17
src/lightbar/rest_api.py
Normal file
17
src/lightbar/rest_api.py
Normal 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'
|
||||
Loading…
Add table
Add a link
Reference in a new issue