ASCII / SCPI

YAML key: ascii

The ASCII adapter serves simple text protocols such as SCPI. It listens on TCP (or UDP), parses newline-terminated commands, and maps them to attributes or custom handlers.

Configuration Example

communication:
  ascii:
    port: 5025
    terminator: "\n"
    response_delay: 0.01
    response_jitter: 0.0
    mappings:
      "MEAS:VOLT?": "#out(voltage)"
      "CONF:MODE {mode}":
        "#attr(measurement_mode)": "mode"
        response: "ACK"

Key fields

  • host (default: 0.0.0.0) — bind address

  • port: TCP port. If omitted, SPX auto-assigns a free port starting at 5025 and writes the effective value into the instance at communication.ascii.port.

  • transport (default: tcp) — tcp|udp

  • terminator: command delimiter (\n, \r\n, etc.).

  • response_delay: base delay inserted before responding (seconds).

  • response_jitter: random delta added to delay (seconds).

  • mappings: legacy command dictionary (still supported; converted internally to bindings). Each key is a command pattern.

    • A string value returns the referenced attribute.

    • A mapping updates attributes or invokes handlers; optional response overrides the reply.

  • bindings: explicit binding definitions (see the spx-examples SCPI multimeter model for a concrete pattern).

Tip: In spx-examples, the SCPI multimeter model omits port so it can run multiple instances without collisions. See multimeter__scpi.yamlarrow-up-right.

Placeholders

Commands may include placeholders ({mode}) that the adapter passes into the mapping as variables. You can write them back to attributes or use them in responses.

Scenarios

Use scenarios to simulate link issues:

Tips

Last updated