# Connecting Input Datasources

> Stream sensor and process data into the Xisom runtime — add an OPC-UA, MQTT, or CSV source, map tags, pair a model, enable, and start inference.

An **input datasource** is one logical source of sensor data — an OPC-UA endpoint, an
MQTT topic group, a CSV replay file, and so on. Each source is a typed adapter with
its own connection settings and tag list. You map its tags to your model's input
channels, then enable it to start inference.

## Supported input sources

- **OPC-UA** — subscribe to tags from any compliant server.
- **MQTT** — bring-your-own broker, TLS supported.
- **CSV** — replay recorded data from a file (great for testing).
- **PLC** — Modbus TCP and other industrial protocols.

**One input enabled at a time**

At most **one** input datasource can be enabled at any moment. Enabling a new source
automatically disables the previous one. This keeps the runtime bound to a single,
predictable stream.

## Walkthrough: add a source and start inference

1. ### Open the Datasources page

   In the dashboard, go to **Datasources → Input**, then click **+ Create**.

2. ### Pick the adapter type and fill the connection

   Select the source type. The form adapts to the protocol you choose — fill in the
   endpoint, credentials, and any protocol-specific fields. Secret fields (passwords,
   tokens) are masked as `***` after saving.

   
     
**OPC-UA**

     | Field | Example |
     |-------|---------|
     | Endpoint | `opc.tcp://your-opcua-host:4840/factory/line1` |
     | Security policy | `None` (or a `Basic256Sha256` profile with certificates) |
     | Authentication | `Anonymous` (or username/password) |

     Tags are referenced by **NodeId**, e.g. `ns=2;i=2` (numeric) or
     `ns=2;s=Temperature` (string).

     
     
**MQTT**

     | Field | Example |
     |-------|---------|
     | Broker URL | `mqtt://your-broker-host:1883` (or `mqtts://` for TLS) |
     | Topic | `factory/line1/temp` |
     | JSON path | `value` (extracts the numeric reading from the message) |
     | Username / password | optional (masked on save) |

     
     
**CSV**

     | Field | Example |
     |-------|---------|
     | File | a recorded dataset to replay |
     | Columns | the sensor columns to feed as channels |

     CSV is replay-only — useful for testing a model without a live plant connection.

     
   

3. ### Map tags to model channels

   List the tags you want to stream and assign each to a numbered **input channel**
   (`0`, `1`, `2`, …). Each channel feeds one model input. Set the **window size** —
   how many consecutive samples the model consumes per prediction — to match the
   model you will pair.

   
**Channel mapping must be complete**

   Provide exactly one tag per channel, with no gaps. Validation rejects an enable if
   any channel is unmapped or over-filled. String tags (e.g. a `RUN`/`STOP` status)
   cannot be used as numeric features — skip them when defining channels.
   

4. ### Save and pair a model

   Save the datasource. Then pair it with a model you uploaded under **Models**. The
   platform runs a compatibility check — `window size × feature count` must agree on
   both sides — and rejects the pairing if they differ.

5. ### Enable, then start

   Toggle **Enable** on the row. This validates the configuration, loads the paired
   model, and connects the adapter. The connection handshake (OPC-UA / MQTT / Modbus)
   happens here, so a network or credential problem surfaces now and rolls the row
   back to **Disabled** with an error message.

   Enabling does **not** auto-start streaming — click **Start** to begin inference.

## Test the connection first

Before enabling, use **Test Connection** on the source. It verifies the live form
values reach the endpoint, so you catch a wrong host or credential before wiring tags.

## Rate limiting and buffering

Each datasource has independent rate limits and a bounded buffer. When a source
produces faster than the runtime consumes, backpressure is reported to the dashboard
so you can spot saturation.

## If something goes wrong

| Symptom | Likely cause |
|---------|--------------|
| Enable fails with `model_not_paired` | Pair a model with the datasource first. |
| Enable rolls back on connect | Endpoint unreachable, wrong credentials, or firewall — verify with **Test Connection**. |
| Row says Enabled but no predictions | By design — press **Start** to begin streaming. |
| Pairing rejected | `window size × feature count` mismatch between model and datasource. |

See the [Troubleshooting](/troubleshooting/) runbook for more.

## Next steps

  - [Send results out](/configure/output-datasources/) — Write predictions back to a PLC, broker, or file.
  - [Deploy a model](/configure/models/) — Upload, pair, and activate models.
