Skip to main content

Telemetry

Device telemetry collection, command dispatch, and insights analysis.

Source: src/telemetry/
Services: TelemetryService, TelemetryInsightsService

API Endpoints

MethodEndpointAuthDescription
POST/telemetryDevice AuthProcess incoming telemetry
POST/telemetry/commandDevice AuthSend command to device
GET/telemetry/metrics/:deviceIdJWTGet device metrics
GET/telemetry/status/:deviceIdJWTGet device status
GET/telemetry/statsJWTAggregate statistics
GET/telemetry/alertsJWTActive telemetry alerts
GET/telemetry/history/:deviceIdJWTHistorical telemetry data
GET/telemetry/exportJWTExport telemetry data
POST/telemetry/log-commandJWTLog a command execution
Mixed Authentication

Some endpoints use @Public() + DeviceAuthGuard for device-to-server communication, while others use standard JWT authentication for dashboard access.

Key Service Methods

TelemetryService

MethodDescription
processTelemetry(data)Ingest and store device telemetry
sendCommand(deviceId, cmd)Dispatch command to device
getMetrics(deviceId)Retrieve current metrics
getStatus(deviceId)Get device online/offline status
getAlerts()List active telemetry alerts
getHistory(deviceId)Historical data with time range
exportData(filters)Export filtered telemetry
logCommand(entry)Record command execution

TelemetryInsightsService

Aggregation and analysis layer on top of raw telemetry data — provides trends, averages, and anomaly flags.

Data Flow

Device → POST /telemetry → TelemetryService.processTelemetry()

┌─────────────┼─────────────┐
▼ ▼ ▼
Store in DB Emit Event Check Alerts
(DeviceMetrics) (telemetry.*) (SmartAlerts)
  • DeviceMetricsModule — Persistent metrics storage
  • SmartAlertsModule — Alert evaluation on telemetry events
  • MqttModule — Alternative telemetry transport