Commands
Send one-way commands to devices from your app. Commands are durably delivered — if a device is offline, the command will be delivered when it reconnects.
Access via app.command.
Commands can be queued per command name. The number of commands you can queue depends on your plan.
API
send()
Send a command to one or more devices.
- JavaScript
- Python
await app.command.send(params)await app.command.send(params)| Parameter | Type | Description |
|---|---|---|
name | string | The command name |
device_ident | string[] | One or more device identifiers to send the command to |
data | any | The command payload |
Returns an object keyed by device identifier with the send result for each
- JavaScript
- Python
const result = await app.command.send({
name: "reboot",
device_ident: ["sensor_01", "sensor_02"],
data: { force: false },
});
result = await app.command.send({
"name": "reboot",
"device_ident": ["sensor_01", "sensor_02"],
"data": {"force": False},
})
Example response:
{
"sensor_01": { "sent": true },
"sensor_02": { "sent": true }
}
If a device identifier doesn't exist, the response will include an error for that device:
{
"sensor_01": { "sent": true },
"sensor_99": { "sent": false, "error": "Device not found" }
}
history()
Query the history of commands sent to devices.
- JavaScript
- Python
await app.command.history(params)await app.command.history(params)| Parameter | Type | Description |
|---|---|---|
name | string | The command name |
device_idents | string[] | Device identifiers to query |
start | string | Start time (ISO 8601) |
end | string | (optional) End time (ISO 8601). Defaults to now |
Returns an object keyed by device identifier, each containing an array of command records
- JavaScript
- Python
const history = await app.command.history({
name: "reboot",
device_idents: ["sensor_01"],
start: "2026-03-01T00:00:00.000Z",
end: "2026-03-02T00:00:00.000Z",
});
history["sensor_01"].forEach((record) => {
console.log(`${JSON.stringify(record.value)} at ${record.timestamp}`);
});
history = await app.command.history({
"name": "reboot",
"device_idents": ["sensor_01"],
"start": "2026-03-01T00:00:00.000Z",
"end": "2026-03-02T00:00:00.000Z",
})
for record in history["sensor_01"]:
print(f"{record['value']} at {record['timestamp']}")
Example response:
{
"sensor_01": [
{
"value": { "force": false },
"timestamp": 1774690309495
},
{
"value": { "reason": "firmware update", "delay_seconds": 5 },
"timestamp": 1774691371229
}
],
"sensor_02": [
{
"value": { "force": false },
"timestamp": 1774861743990
}
]
}
Each device identifier is its own key in the response. Each record contains the command value (the payload that was sent) and the timestamp in milliseconds.
If a device has no command history in the queried range, the array will be empty:
{
"sensor_01": []
}
History retention depends on your plan. For example, the free plan retains 3 days of history. Queries outside your retention window will return empty arrays.