iot-hub-dashboard-builderlisted
Install: claude install-skill RMAzrim/opencode-artes
# IoT Hub Dashboard Builder
Build a miniature IoT platform - broker, simulated devices, rules engine, and dashboard feed - using only the Python standard library. Emulates the MQTT publish/subscribe model (topics, retained messages, QoS-0) over plain TCP, so the entire system runs on `127.0.0.1` without installing Eclipse Mosquitto or any external broker.
## 1. System Architecture & Prerequisites
- **Runtime**: CPython 3.9+ (`socket`, `threading`, `json`, `time`, `sqlite3`, `random`, `csv`, `datetime`). No MQTT client libraries, no Docker, no MCP.
- **Components**:
- `IotHubBroker` (TCP `127.0.0.1:18832`) — accepts JSON frames `{"op": "connect|publish|subscribe|disconnect", "client_id", "topic", "payload", "retain"}`; maintains a topic→subscribers map and a retained-store.
- `SimulatedDevice` — publishes telemetry on a loop (e.g. `factory/line1/temp`, `factory/line1/humidity`) with realistic drift + occasional spikes.
- `RuleEngine` — runs in the broker thread, matches `rule` dicts `{topic_pattern, field, op, value, cooldown_s}` and emits `alert` frames + appends to `dashboard_feed.csv`.
- `DashboardSink` — collates latest retained telemetry per topic into `stats.json` for a dashboard.
- **Wire contract**: newline-delimited JSON (NDJSON) over TCP, `\n`-terminated frames; both broker and client tolerate truncated/oversized frames.
## 2. Input/Output Data Contracts
| Frame `op` | Direction | Payload |
|---|---|---|
| `connect` | client→broker | `{client