For Web Developers
You build the web app. Here's how to receive data and send commands.
Connection Flow
1
Listen for { "t": "device_online", "serial": "..." } / device_offline
2
Receive data: { "t": "telemetry", "serial": "...", "ts": ..., "temp": 22.5 }
3
Send commands: { "t": "cmd", "serial": "...", "target": "turn1", "action": "open" }
1
Listen for
{ "t": "device_online", "serial": "..." } / device_offline
2
Receive data:
{ "t": "telemetry", "serial": "...", "ts": ..., "temp": 22.5 }
3
Send commands:
{ "t": "cmd", "serial": "...", "target": "turn1", "action": "open" }What You Receive
What You Send
REST API
All REST endpoints require Authorization: Bearer <password>. Errors return { "error": "message" }. Status codes: 200, 201, 401, 404.
GET
/api/devices
List all registered devices
GET
/api/devices/:serial
Get single device details
GET
/api/devices/:serial/code
Get connection code for device
GET
/api/history?serial=...&type=...&limit=100
Query stored messages
GET
/api/protocol
Protocol docs as JSON
POST
/api/devices
Create device → { serial, code }
POST
/api/devices/:serial/reset
Reset device (invalidates token, re-pair required)
POST
/api/devices/:serial/regenerate
Regenerate connectionCode (invalidates token)
DELETE
/api/devices/:serial
Delete a device permanently
Live: What Your App Receives
This is exactly what arrives in your ws.onmessage handler. Click a message to see the full JSON.
Waiting for messages…
Try It: Gateway Simulator
Simulate an ESP32 in your browser to test your app without hardware.