deviceHistory
The deviceHistory router: 14 methods of the device-history capability, with tier, scope, input and output.
Capability device-history · scope system · mode singleton · source packages/types/src/capabilities/device-history.cap.ts:328.
Every method is called at /trpc/deviceHistory.<method> — queries with GET, mutations with POST. See How to call and Authorization.
| Method | Kind | Tier | Token scope | Viewer |
|---|---|---|---|---|
listSeries | query | protected | view | no |
listNodeSeries | query | admin | admin only | no |
query | query | protected | view | no |
queryNode | query | admin | admin only | no |
queryMany | query | admin | admin only | no |
declareSeries | mutation | admin | admin only | no |
record | mutation | admin | admin only | no |
recordBuckets | mutation | admin | admin only | no |
getDeviceEnabled | query | protected | view | no |
setDeviceEnabled | mutation | admin | admin only | no |
getStatus | query | admin | admin only | no |
listOrphanSeries | query | admin | admin only | no |
deleteOrphanSeries | mutation | admin | admin only | no |
deleteSeriesRange | mutation | admin | admin only | no |
deviceHistory.listSeries
- Kind: query —
GET /trpc/deviceHistory.listSeries - Tier: protected — any signed-in principal whose scopes cover the method
- Token scope:
viewon capabilitydevice-history, or categorysystem - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.listSerieson your hub
Input
{ deviceId: number }Output
({ key: string; scope: string; kind: DeviceHistoryKindSchema; unit: string | null; displayName: string; source: "cap" | "addon" | "derived"; values: string[] | null; firstTs: number; lastTs: number })[]Shapes: DeviceHistoryKindSchema
deviceHistory.listNodeSeries
- Kind: query —
GET /trpc/deviceHistory.listNodeSeries - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.listNodeSerieson your hub
Input
{ forNodeId: string }Output
({ key: string; scope: string; kind: DeviceHistoryKindSchema; unit: string | null; displayName: string; source: "cap" | "addon" | "derived"; values: string[] | null; firstTs: number; lastTs: number })[]Shapes: DeviceHistoryKindSchema
deviceHistory.query
- Kind: query —
GET /trpc/deviceHistory.query - Tier: protected — any signed-in principal whose scopes cover the method
- Token scope:
viewon capabilitydevice-history, or categorysystem - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.queryon your hub
Input
{ deviceId: number; key: string; scope?: string; from: number; to: number; resolution?: DeviceHistoryResolutionSchema | "auto" = "auto"; maxPoints?: number = 1000 }Output
{ resolution: DeviceHistoryResolutionSchema; series: ({ scope: string; before: { t: number; value: number | null; state: string | null } | null; points: ({ t: number; samples: number; mean: number | null; twMean: number | null; min: number; max: number; last: number | null; delta: number | null; state: string | null; states: Record<string, number> | null })[]; derivedFrom: string | null })[]; truncated: boolean }Shapes: DeviceHistoryResolutionSchema
deviceHistory.queryNode
- Kind: query —
GET /trpc/deviceHistory.queryNode - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.queryNodeon your hub
Input
{ forNodeId: string; key: string; scope?: string; from: number; to: number; resolution?: DeviceHistoryResolutionSchema | "auto" = "auto"; maxPoints?: number = 1000 }Output
{ resolution: DeviceHistoryResolutionSchema; series: ({ scope: string; before: { t: number; value: number | null; state: string | null } | null; points: ({ t: number; samples: number; mean: number | null; twMean: number | null; min: number; max: number; last: number | null; delta: number | null; state: string | null; states: Record<string, number> | null })[]; derivedFrom: string | null })[]; truncated: boolean }Shapes: DeviceHistoryResolutionSchema
deviceHistory.queryMany
- Kind: query —
GET /trpc/deviceHistory.queryMany - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.queryManyon your hub
Input
{ items: ({ deviceId: number; key: string; scope?: string } | { forNodeId: string; key: string; scope?: string })[]; from: number; to: number; resolution?: DeviceHistoryResolutionSchema | "auto" = "auto"; maxPoints?: number = 1000 }Output
{ results: ({ ok: true; result: { resolution: DeviceHistoryResolutionSchema; series: ({ scope: string; before: {…} | null; points: {…}[]; derivedFrom: string | null })[]; truncated: boolean } } | { ok: false; error: string })[] }Shapes: DeviceHistoryResolutionSchema
deviceHistory.declareSeries
- Kind: mutation —
POST /trpc/deviceHistory.declareSeries - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.declareSerieson your hub
Input
{ name: string; subjectKind: "device" | "node"; kind: DeviceHistoryProducerKindSchema; unit?: string; displayName: string; ingest: "points" | "buckets" }Output
{ key: string }Shapes: DeviceHistoryProducerKindSchema
deviceHistory.record
- Kind: mutation —
POST /trpc/deviceHistory.record - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.recordon your hub
Input
{ points: ({ key: string; subject: DeviceHistorySubjectSchema; scope?: string = ""; ts: number; value: number })[] }Output
{ accepted: number; refused: ({ key: string; reason: DeviceHistoryRefusalReasonSchema; count: number })[] }Shapes: DeviceHistorySubjectSchema · DeviceHistoryRefusalReasonSchema
deviceHistory.recordBuckets
- Kind: mutation —
POST /trpc/deviceHistory.recordBuckets - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.recordBucketson your hub
Input
{ buckets: ({ key: string; subject: DeviceHistorySubjectSchema; scope?: string = ""; bucketStart: number; samples: number; sum: number; min: number; max: number; last: number | null; lastTs: number | null })[] }Output
{ accepted: number; refused: ({ key: string; reason: DeviceHistoryRefusalReasonSchema; count: number })[] }Shapes: DeviceHistorySubjectSchema · DeviceHistoryRefusalReasonSchema
deviceHistory.getDeviceEnabled
- Kind: query —
GET /trpc/deviceHistory.getDeviceEnabled - Tier: protected — any signed-in principal whose scopes cover the method
- Token scope:
viewon capabilitydevice-history, or categorysystem - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.getDeviceEnabledon your hub
Input
{ deviceId: number }Output
{ enabled: boolean }deviceHistory.setDeviceEnabled
- Kind: mutation —
POST /trpc/deviceHistory.setDeviceEnabled - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.setDeviceEnabledon your hub
Input
{ deviceId: number; enabled: boolean }Output
{ enabled: boolean }deviceHistory.getStatus
- Kind: query —
GET /trpc/deviceHistory.getStatus - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.getStatuson your hub
Input
{}Output
DeviceHistoryStatusSchemaShapes: DeviceHistoryStatusSchema
deviceHistory.listOrphanSeries
- Kind: query —
GET /trpc/deviceHistory.listOrphanSeries - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.listOrphanSerieson your hub
Input
{}Output
{ series: ({ seriesId: number; deviceId: number; key: string; scope: string; displayName: string | null; reason: DeviceHistoryOrphanReasonSchema; missingSince: number | null; firstTs: number; lastTs: number; rows: { raw: number; 5m: number; 1h: number; 1d: number } })[]; truncated: boolean }Shapes: DeviceHistoryOrphanReasonSchema
deviceHistory.deleteOrphanSeries
- Kind: mutation —
POST /trpc/deviceHistory.deleteOrphanSeries - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.deleteOrphanSerieson your hub
Input
{ seriesIds: number[] }Output
{ results: ({ seriesId: number; ok: true; deleted: { raw: number; 5m: number; 1h: number; 1d: number } } | { seriesId: number; ok: false; reason: DeviceHistoryOrphanDeleteRefusalSchema })[] }Shapes: DeviceHistoryOrphanDeleteRefusalSchema
deviceHistory.deleteSeriesRange
- Kind: mutation —
POST /trpc/deviceHistory.deleteSeriesRange - Tier: admin — an administrator; a viewer only as the Viewer line says; never a scoped token
- Token scope: none — the admin tier needs an administrator (a
*token or an admin session) - Viewer: no
- Try it: open
/system/api-explorer?method=deviceHistory.deleteSeriesRangeon your hub
Input
{ deviceId: number; key: string; scope: string; fromMs: number; toMs: number; dryRun: boolean }Output
{ ok: true; dryRun: boolean; seriesId: number; rows: { raw: number; 5m: number; 1h: number; 1d: number }; rewritten: { 5m: number; 1h: number; 1d: number } | null } | { ok: false; reason: DeviceHistoryRangeDeleteRefusalSchema }