feat(api): FastAPI bridge for pont bascule via serial + Tailscale access

- Add FastAPI service exposing /health, /last, /send/esclave, /send/dsd, /send/custom
- Implement SerialBridge aligned with legacy Tkinter behavior (open delay 2s, post-write 0.5s, read in_waiting once)
- Enforce single in-flight serial request (non-blocking lock, returns 409 BUSY)
- Add environment-based serial configuration (.env + systemd EnvironmentFile)
- Document installation, systemd service, and Tailscale usage (direct IP and tailscale serve)
This commit is contained in:
2026-01-09 15:32:10 +00:00
parent ee2594b9cf
commit fce468cf76
12 changed files with 528 additions and 2 deletions

20
app/test_api.py Normal file
View File

@@ -0,0 +1,20 @@
from fastapi import FastAPI
from pydantic import BaseModel
import time
app = FastAPI(title="Test API (no serial)")
class Echo(BaseModel):
msg: str
@app.get("/health")
def health():
return {"ok": True, "ts": time.time()}
@app.get("/ping")
def ping():
return {"pong": True}
@app.post("/echo")
def echo(body: Echo):
return {"echo": body.msg}