Step 5 of 6
Send Commands
Control your connected devices in real-time from the dashboard, and learn how to handle commands on the device side.
How to Send Commands
Via Dashboard
- 1Go to Devices
- 2Click on a device to open details
- 3Use quick command buttons or custom input
- 4Click Send
Via WebSocket (Admin)
{
"type": "command",
"device_id": "uuid-here",
"command": "lock",
"payload": {}
}Connect as admin with subscribe first.
Command Reference
Common commands for each device type
| Command | Description | Example Payload | |
|---|---|---|---|
lock | Lock the door | {} | |
unlock | Unlock the door | {} | |
status | Get lock status | {} | |
set_auto_lock | Enable auto-lock | {"delay": 30} |
Handling Commands on Device
How to process incoming commands in your device code
JavaScript Example
ws.on("message", (data) => {
const msg = JSON.parse(data.toString())
if (msg.type === "command") {
const { command, payload } = msg
switch (command) {
case "lock":
// Activate lock mechanism
activateLock()
sendAck("lock", "success")
break
case "unlock":
// Deactivate lock mechanism
deactivateLock()
sendAck("unlock", "success")
break
case "status":
// Send current status
ws.send(JSON.stringify({
type: "event",
event_type: "status_response",
payload: { locked: isLocked, battery: getBatteryLevel() }
}))
break
default:
console.log("Unknown command:", command)
}
}
})Command Delivery Status
pending
Command sent, awaiting device
delivered
Device received command
failed
Device offline or error
View command history and delivery status in the Command History page.
Best Practices
- Always validate command payloads on the device side
- Implement acknowledgment responses for critical commands
- Use timeouts for commands that require confirmation
- Log all commands for audit purposes (automatic in this system)
- Test commands with device in a safe state first