Skip to main content

Telemetry

Stream live telemetry from devices, query historical data over time ranges, and fetch the latest reading for any metric.

Access via app.telemetry.

API

stream()

Subscribe to live telemetry from a device.

app.telemetry.stream(params)
ParameterTypeDescription
device_identstringThe device identifier
metricstring[] or "*"Metrics to subscribe to. Use "*" for all metrics
callbackfunctionCalled with each incoming reading
// subscribe to specific metrics
app.telemetry.stream({
device_ident: "sensor_01",
metric: ["temperature", "humidity"],
callback: (data) => {
console.log(`${data.metric}:`, data.data);
},
});

// subscribe to all metrics
app.telemetry.stream({
device_ident: "sensor_01",
metric: "*",
callback: (data) => {
console.log(`${data.metric}:`, data.data);
},
});

off()

Unsubscribe from live telemetry.

app.telemetry.off(params)
ParameterTypeDescription
device_identstringThe device identifier
metricstring[](optional) Specific metrics to unsubscribe. Omit to unsubscribe all
// unsubscribe from specific metrics
app.telemetry.off({
device_ident: "sensor_01",
metric: ["temperature"],
});

// unsubscribe from all metrics for a device
app.telemetry.off({
device_ident: "sensor_01",
});

history()

Query historical telemetry data over a time range.

await app.telemetry.history(params)
ParameterTypeDescription
device_identstringThe device identifier
fieldsstring[]Metrics to query
startstringStart time (ISO 8601)
endstringEnd time (ISO 8601)

Returns an object keyed by metric name, each containing an array of data points

const history = await app.telemetry.history({
device_ident: "sensor_01",
fields: ["temperature", "humidity"],
start: "2026-03-01T00:00:00.000Z",
end: "2026-03-02T00:00:00.000Z",
});

// history.temperature = [{ value: 22.5, timestamp: ... }, ...]
// history.humidity = [{ value: 61.3, timestamp: ... }, ...]
history.temperature.forEach((point) => {
console.log(`${point.value} at ${point.timestamp}`);
});

Example response:

{
"temperature": [
{ "value": 22.5, "timestamp": 1774690200000 },
{ "value": 23.1, "timestamp": 1774690205000 },
{ "value": 22.8, "timestamp": 1774690210000 }
],
"humidity": [
{ "value": 61.3, "timestamp": 1774690200000 },
{ "value": 60.8, "timestamp": 1774690205000 }
]
}

If a metric has no data in the queried range, the array will be empty:

{
"temperature": [],
"humidity": []
}
History retention

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.

latest()

Get the most recent reading for each metric.

await app.telemetry.latest(params)
ParameterTypeDescription
device_identstringThe device identifier
fieldsstring[]Metrics to query
startstringStart of lookup window (ISO 8601)
endstringEnd of lookup window (ISO 8601)

Returns an object keyed by metric name, each containing the latest value and time

const latest = await app.telemetry.latest({
device_ident: "sensor_01",
fields: ["temperature", "humidity"],
start: "2026-03-28T00:00:00.000Z",
end: "2026-03-29T00:00:00.000Z",
});

// latest.temperature = { value: 25.3, time: "2026-03-28T23:59:00.000Z" }
console.log("Temperature:", latest.temperature.value);
console.log("Humidity:", latest.humidity.value);

Example response:

{
"temperature": { "value": 25.3, "time": "2026-03-28T23:59:00.000Z" },
"humidity": { "value": 60.1, "time": "2026-03-28T23:58:45.000Z" }
}