Introduction KRANE™ Knowledge Base
Working version v2.23-Woodpecker- App version 1.35.x v2.21-Umbrellabird- App version 1.33.0 v2.19 Sparrow - App version 1.31.1 v2.18 Raven - App version 1.30.5 v2.17.1 - App version 1.30 v2.17 Quail - App version 1.28.0 v2.16 Pelican
Working version v2.23-Woodpecker- App version 1.35.x v2.21-Umbrellabird- App version 1.33.0 v2.19 Sparrow - App version 1.31.1 v2.18 Raven - App version 1.30.5 v2.17.1 - App version 1.30 v2.17 Quail - App version 1.28.0 v2.16 Pelican English Dutch

MP-09 IoT Device Monitoring: Real-Time Visualization of Device Metrics in Management Portal

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:

JSON
{
  "temp": 20,
  "avg_temp": 20,
  "min_temp": 10,
  "max_temp": 30
}

Then the corresponding chart configuration entry could be:

JSON
{
  "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

  1. Register or update device with chart_configs via the API.

  2. Device publishes MQTT messages to its authorized topic with payload containing the configured fields.

  3. Backend stores messages; the portal reads configured paths and renders charts per device.

API Reference

Device Create/Update endpoint (OpenAPI):

Staging

Production

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:

JSON
{
  "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.

FAQ

Click to expand...


Click to expand...


Click to expand...