HAL API — TTS / STT / Mic / Speaker / LED
Full HAL routes live in hal/routes/. Reach them from the device with
curl http://127.0.0.1:5001/…, or from your laptop through os-server at
http://<device-ip>/api/hardware/… — that path is admin-gated, so send a
Bearer token (see Customize → HTTP API).
The interactive Swagger UI is at http://<device-ip>/api/hardware/docs.
HAL is a plain FastAPI app. Action endpoints answer {"status": "ok"} (some
add fields, e.g. /led/effect echoes the effect and speed); read endpoints
return their own payload. Errors come back as a non-2xx status with
FastAPI's {"detail": "…"} body.
Two ways to call anything in this section:
- Over HTTP (from anywhere — a Python script, a curl, another service).
- In-process from HAL Python code — import the route function directly and call it with the pydantic request. Useful when you're writing a new HAL driver or route.