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
22
src/lightbar/app.py
Normal file
22
src/lightbar/app.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import machine
|
||||
import uasyncio
|
||||
from microdot_asyncio import Microdot
|
||||
|
||||
from lightbar.frontend import frontend
|
||||
from lightbar.rest_api import rest_api
|
||||
|
||||
|
||||
class Lightbar(Microdot):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.mount(frontend)
|
||||
self.mount(rest_api, url_prefix='/api')
|
||||
|
||||
async def scheduled_shutdown(self):
|
||||
await uasyncio.sleep(0.1)
|
||||
self.shutdown()
|
||||
|
||||
@staticmethod
|
||||
async def scheduled_reboot():
|
||||
await uasyncio.sleep(0.1)
|
||||
machine.reset()
|
||||
Loading…
Add table
Add a link
Reference in a new issue