Files
home-automation-backend/main.py

23 lines
387 B
Python
Raw Normal View History

2024-07-16 15:55:45 +02:00
from contextlib import asynccontextmanager
from fastapi import FastAPI
from poo import PooRecorder
recorder = PooRecorder()
@asynccontextmanager
async def _lifespan(_app: FastAPI):
await recorder.start()
yield
await recorder.stop()
app = FastAPI(lifespan=_lifespan)
@app.put("/record/s={status}")
async def record(status: str) -> dict:
return {"status": status}