Skip to main content

Step 1: Parse Adapter-Decoded Registers

The input is a synthetic line emitted after gateway decoding. Expanso splits its fields, applies the example register map, and produces JSON.

Boundary

The gateway owns protocol polling, framing, reconnect behavior, device authentication, and raw-register decoding. This mapping starts with delimited text; it is not a Modbus client.

Reference configuration

input:
socket:
network: tcp
address: 0.0.0.0:502
codec: lines

pipeline:
processors:
- mapping: |
let fields = content().string().split(";").fold({}, (acc, item) -> {
let parts = item.split("=")
acc | { parts[0]: parts[1] }
})
let reg = fields.REG.number()
let val = fields.VAL.number()

root.voltage_kv = if reg == 40001 { val / 100.0 } else { deleted() }
root.device_id = fields.DEVICE
root.register = reg
root.raw_value = val
root.status = fields.STATUS.number()
root."@timestamp" = fields.TS.number()

For register 40001, a value of 14823 becomes voltage_kv: 148.23. The mapping also retains the device identifier, register, raw value, status, and timestamp.

Review before implementation

  • Confirm addressing conventions with the gateway and device documentation.
  • Confirm each unit and scale factor with the site owner.
  • Define behavior for missing, malformed, duplicated, or out-of-order fields.
  • Decide whether the socket port and record framing are appropriate for the deployment boundary.

This checked-in fragment has not been exercised against a protocol adapter or assessed for malformed-input behavior.

Source artifact: examples/integrations/scada-energy-edge/step-1-parse-registers.yaml.

Next: Inspect record selection.