Affiche la batterie de la Kobo (push via params /image.png) en pied de page
This commit is contained in:
@@ -14,6 +14,7 @@ from fastapi.responses import HTMLResponse
|
||||
|
||||
import render
|
||||
from config import config
|
||||
from integrations import kobo
|
||||
|
||||
app = FastAPI(title="Monitorink", docs_url=None, redoc_url=None)
|
||||
|
||||
@@ -26,7 +27,9 @@ async def health() -> dict:
|
||||
|
||||
|
||||
@app.get("/image.png")
|
||||
async def image(fresh: int = 0) -> Response:
|
||||
async def image(fresh: int = 0, bat: int | None = None, chg: int = 0) -> Response:
|
||||
# La Kobo pousse sa batterie ici (bat=0-100, chg=1 si en charge) à chaque fetch.
|
||||
kobo.record(bat, bool(chg))
|
||||
now = time.time()
|
||||
cached = _cache["png"]
|
||||
age = now - float(_cache["ts"])
|
||||
|
||||
Reference in New Issue
Block a user