Skip to Content

Canonical Keys

Map device-specific data to ModularIoT’s standardized metric keys. This guide shows how to translate OBD-II PIDs, J1939 SPNs, and proprietary formats to canonical keys.

Key Naming Convention

Canonical keys use dot-notation hierarchy:

domain.metric domain.subdomain.metric

Examples:

  • engine.rpm
  • engine.coolant_temp
  • fuel.level

OBD-II PID Mapping

Standard OBD-II PIDs map directly to canonical keys:

OBD-II PIDRaw FormulaCanonical KeyUnitNotes
0x04A × 100/255engine.load%Calculated load
0x05A - 40engine.coolant_temp°COffset by 40
0x0C(A×256 + B) / 4engine.rpmrpmTwo-byte value
0x0DAvehicle.speedkm/hDirect
0x0FA - 40engine.intake_air_temp°COffset by 40
0x11A × 100/255throttle.position%Percentage
0x1FA×256 + Bengine.runtimesRun time since start
0x2FA × 100/255fuel.level%Tank level
0x31(A×256 + B)odometerkmDistance since codes cleared
0x42(A×256 + B) / 1000battery.voltageVControl module voltage

J1939 SPN Mapping

Heavy-duty vehicles use J1939 SPNs:

J1939 SPNCanonical KeyUnitNotes
84vehicle.speedkm/hWheel-based speed
190engine.rpmrpmEngine speed
247engine.total_runtimehTotal engine hours
513engine.torque_pct%Actual engine torque
110engine.coolant_temp°CCoolant temperature

Diagnostics Keys

Diagnostic trouble codes have special handling:

KeyTypeDescription
dtc.mil_onbooleanMalfunction indicator lamp status
dtc.codesarrayActive DTC codes (e.g., ["P0301", "P0420"])
dtc.countintegerNumber of active codes

The dtc.codes array contains standard OBD-II codes:

  • P = Powertrain
  • C = Chassis
  • B = Body
  • U = Network

Derived Metrics

Some metrics are computed from raw data:

KeyTypeDerivation
idle.statebooleanengine.rpm > 0 AND vehicle.speed ≈ 0

Drivers can compute these locally or send raw data for platform-side derivation.

Unit Conventions

All metrics use canonical SI-derived units:

MeasurementCanonical UnitNever Use
Speedkm/hmph, m/s
Temperature°C°F, K
VolumeLgallons, m³
Distancekmmiles, m
PressurekPaPSI, bar
Percentage% (0-100)0-1 ratio

Conversion is the SDK/driver’s responsibility. ModularIoT expects canonical units.

Custom Keys

For metrics not in the registry:

  1. Use the custom. prefix
  2. Register via the Configuration API
  3. Document the semantics

Example: custom.fleet.utilization_score

Complete Registry

For the authoritative list of all supported keys, ranges, and specifications:

Reference > Metrics Registry

Last updated on