EdgeTwin
Dec 2025 — Feb 2026Factory-floor telemetry for 20 simulated motors — streamed, stored, and alerted on in real time.
- A simulator publishes motor telemetry over MQTT into FairCom Edge, which acts as both broker and database. A FastAPI service reads from it and serves a React dashboard with live status, charts, and alert history.
- Alerting uses hysteresis — one threshold to raise an alert and a separate, lower one to clear it — so an alert doesn't flap while a reading sits on the boundary.
- The FairCom client is a module-level singleton:
get_client()is synchronous,init_client()is async. They're split because authentication is a network call, and the client is initialised once from alifespanstartup hook. - The alert loop runs as a background
asyncio.create_taskalongside the request handlers. - Docker Compose healthchecks gate startup order, so the API doesn't come up before the broker is ready to accept it.
- Known limitAlert counters are held in memory, so they reset whenever the service restarts.