← Back to the chapter

Technical detail · Edge, Fog, and Cloud: Device Integration

Preserve a Modbus measurement and returning command

Protocol translation silently corrupts data when it drops metadata. A Modbus holding register holds 16 bits; the device documentation defines their interpretation and any implied scale. If a temperature sensor reports tenths of a degree Celsius, the gateway must apply the scale before publishing northbound:

Modbus holding register 0x00D2 = 214
device documentation: temperature scale is 0.1 C
214 x 0.1 = 21.4 C

wrong northbound record:
{ "value": 214 }

correct northbound record:
{
  "device_id": "gw1/modbus/17",
  "value": 21.4,
  "unit": "celsius",
  "event_time": "2026-07-03T10:15:04Z",
  "schema_version": "temperature.v2"
}

The wrong record can pass a schema check while still being wrong: it means 214, not 21.4 C, and it has no device identity or measurement time. The gateway preserves meaning by applying scale, attaching units, binding the reading to a provisioned identity, and stamping the event time before the cloud stores it.

The same rule applies to commands. A northbound command such as “set fan speed to 40%” becomes a device-specific frame only after the gateway checks target identity, firmware compatibility, command freshness, permitted range, and local safety state. Translation is a meaning-preservation problem in both directions, not only a format conversion.

← Back to the chapter