MP-09 IoT Device Monitoring
Purpose: Enable real-time visualization of device-reported metrics in the Management Portal by letting each device declare what to chart via its own configuration.
Who is this for: Engineers setting up devices and project owners who need operational monitoring of IoT data streams.
Overview
MP-09 allows a device to specify which payload fields should be plotted in the Management Portal. The feature has two prerequisites:
-
Device configuration includes chart configurations (chart_configs).
-
The device publishes MQTT payloads that contain the configured fields.
chart_configs can define the main value path and optional paths for average, minimum, maximum, and standard deviation. The portal uses these to render single or multi-series charts with bands (e.g., min–max).
Key Concepts
-
Payload: JSON body sent by the device over MQTT that contains the telemetry to plot.
-
Chart configuration: Per-device mapping that tells the portal which payload paths to read for each charted metric.
-
Path: Dot-notation path inside the payload (e.g., temp, env.room.temp, metrics[0].value).
Example
If the incoming payload is:
{
"temp": 20,
"avg_temp": 20,
"min_temp": 10,
"max_temp": 30
}
Then the corresponding chart configuration entry could be:
{
"path": "temp",
"avg_path": "avg_temp",
"min_path": "min_temp",
"max_path": "max_temp"
}
Best practice: Keep the payload schema stable and versioned. If you need to change paths, update the device’s chart_configs to match before publishing new payloads.
Configuration
You set chart_configs when creating or updating a device via the IoT Devices API. Each device may have one or multiple chart configurations, one per metric to display.
-
Required: path (main time series).
-
Optional: avg_path, min_path, max_path, std_path for additional series or bands.
-
Optional metadata (suggested): unit, label, decimals, color, aggregation (e.g., mean, median), window (e.g., 1m, 5m) — implementation-specific.
Data Flow
-
Register or update device with chart_configs via the API.
-
Device publishes MQTT messages to its authorized topic with payload containing the configured fields.
-
Backend stores messages; the portal reads configured paths and renders charts per device.
API Reference
Device Create/Update endpoint (OpenAPI):
MQTT Requirements
-
Protocol: MQTT v5 over TLS.
-
Topic format: /iot/{organizationName}/{deviceId} (publish only on authorized topics).
-
QoS: Use a level appropriate for delivery guarantees; retained messages optional depending on use case.
chart_configs Schema (proposed)
A chart configuration item typically includes:
{
"label": "Temperature",
"unit": "°C",
"path": "temp",
"avg_path": "avg_temp",
"min_path": "min_temp",
"max_path": "max_temp",
"std_path": "std_temp",
"decimals": 1,
"color": "#FF6B6B",
"aggregation": "mean",
"window": "1m"
}
Exact schema may evolve with gateway versions. Consult the OpenAPI spec linked above for the authoritative contract.
Validation & Error Handling
-
If a configured path is missing in payload, the chart will show gaps. Ensure device firmware and chart_configs stay in sync.
-
Invalid paths (e.g., wrong nesting) should be rejected at configuration time or logged at render time for observability.
-
Use units and decimals to prevent misleading scales or rounding artifacts.
Security & Access
-
Device identity and topic authorization are enforced at the MQTT broker. Devices can only publish to their own topics.
-
Portal access to charts follows project and organization access controls.
Operational Playbook
|
Task |
Owner |
How to verify |
|---|---|---|
|
Register device with chart_configs |
Engineer |
GET device via API and confirm chart_configs saved |
|
Publish MQTT payloads matching chart paths |
Engineer |
Observe portal charts update without errors |
|
Monitor logs for missing paths or parsing issues |
Device Monitor / Project Manager |
No recurring warnings; metrics plotted as expected |
Troubleshooting
-
Charts are empty: Confirm the payload fields exist and match the configured paths exactly (case-sensitive).
-
Only main line shows, no bands: Ensure min_path/max_path or std_path are present in both chart_configs and payloads.
-
Inconsistent units: Align device-side units with chart_configs unit; avoid mixing °C and °F on the same metric.