> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/workflows/tutorials/integrate-with-ignition/live-data/read-the-roboflow-opc-ua-server.md).

# Read the Roboflow OPC UA Server

Connect Ignition to the OPC UA Server on a Roboflow edge device and read the tags a Workflow writes there.

Use this path when Ignition or a PLC should poll tags on the device instead of receiving writes. The OPC UA Server is a service on the Roboflow device: a Workflow writes tags to it, and Ignition reads them as a client.

{% hint style="info" %}
The OPC UA Writer Sink, the OPC UA Reader, and the OPC UA Server are available exclusively for Enterprise customers. [Contact the Roboflow sales team](https://roboflow.com/sales) to learn more.
{% endhint %}

{% hint style="info" %}
These steps and screenshots are from Ignition 8.1 (Designer 8.1.55). Menu names, dialogs, and property names can differ in other versions, including 8.3.
{% endhint %}

## Example Tags

This page uses three tags to show the pattern. They are an example for illustration: define your own folders, names, and data types to fit your line, and use the same names in the Workflow.

<table data-search="false"><thead><tr><th>Tag</th><th>Data type</th><th>What it means</th></tr></thead><tbody><tr><td><code>Line1/DefectFound</code></td><td>Boolean</td><td><code>true</code> when the last case failed inspection</td></tr><tr><td><code>Line1/PassCount</code></td><td>Int32</td><td>How many cases passed this shift</td></tr><tr><td><code>Line1/LastResult</code></td><td>String</td><td><code>pass</code> or <code>fail</code> for the last case</td></tr></tbody></table>

## Add the OPC UA Server to the Device

1. In Deployment Manager, open the device, go to the "Services" tab, and click "Add Service". Pick "OPC UA Server".
2. In "Configure OPC UA Server", keep the "Server Settings" defaults or change them. Note the "Namespace URI" (default `http://opcua.roboflow.run`), because the Workflow needs it.

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-898a7744caff2ff953cc53f33178b90e5b9619dd%2Fignition-dm-opcua-server-settings.png?alt=media" alt="The Configure OPC UA Server modal in Deployment Manager with Server Name Roboflow OPC UA Server, Namespace URI http://opcua.roboflow.run, Max Sessions 200, and Require Authentication off" width="500"><figcaption><p>The server settings.</p></figcaption></figure>
3. Under "Folders", click "+ Add Folder" and add `Line1`.
4. Under "Tags", click "+ Add Tag" for each tag. Set "Display Name", "Browse Name", "Data Type", and "Folder", and keep "Access Level" at "ReadWrite" so the Workflow can write it. Clients find the tag by its "Browse Name".

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-9afd0521b6166357fe38494be7b685e258c2cd31%2Fignition-dm-opcua-server-add-tag.png?alt=media" alt="The Add Tag dialog with Display Name Defect Found, Browse Name DefectFound, Data Type Boolean, Access Level ReadWrite, Folder Line1, and Initial Value false" width="500"><figcaption><p>The example <code>DefectFound</code> tag.</p></figcaption></figure>
5. Check the folder and tags, then click "Add Service". Add at least one tag, because the server does not start with an empty tag list.

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-32b4c65491f93811c09e604ac025f88c1ebdbea4%2Fignition-dm-opcua-server-tags.png?alt=media" alt="The Configure OPC UA Server modal with a Line1 folder and three tags: Defect Found Boolean, Pass Count Int32, and Last Result String, all ReadWrite in Line1" width="500"><figcaption><p>The example folder and tags, ready to add.</p></figcaption></figure>

The server publishes the tags at `opc.tcp://<device-ip>:4840/opcua/server`.

## Write to the Server from the Workflow

Build the Workflow as in [Write Results to Ignition](/workflows/tutorials/integrate-with-ignition/live-data/write-results-to-ignition.md#build-the-workflow), with one OPC UA Writer Sink per tag, but point each Writer Sink at the device's server:

<table data-search="false"><thead><tr><th>Field</th><th>Value</th></tr></thead><tbody><tr><td>"Url"</td><td><code>opc.tcp://&#x3C;device-ip>:4840/opcua/server</code></td></tr><tr><td>"Namespace"</td><td>The server's "Namespace URI" (ex: <code>http://opcua.roboflow.run</code>)</td></tr><tr><td>"Object Name"</td><td>The folder (ex: <code>Line1</code>)</td></tr><tr><td>"Variable Name"</td><td>The tag's "Browse Name" (ex: <code>DefectFound</code>)</td></tr><tr><td>"Value Type"</td><td>The tag's "Data Type" (ex: "Boolean")</td></tr><tr><td>"Node Lookup Mode"</td><td>"hierarchical", the default. "direct" does not find these tags.</td></tr></tbody></table>

Leave "User Name" and "Password" empty unless you turned on "Require Authentication".

## Connect Ignition to the Server

Ignition connects to the device as a client, so its own OPC UA server settings do not need to change.

1. In the Ignition Gateway, go to "Config" > "OPC Client" > "OPC Connections", click "Create new OPC Connection...", pick "OPC UA", and click "Next". Enter `opc.tcp://<device-ip>:4840/opcua/server` as the "Endpoint URL" and click "Next" through the server and endpoint steps. Pick the endpoint with "Security Policy: None".

   The server reports its address by hostname. If Ignition cannot resolve it, the wizard asks for an alternative: keep "Substitute URL From Discovery" and "Substitute Hostname From Discovery", which use the IP address you entered.

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-636f94b18f0eac9e413f29368723d5c436990b5a%2Fignition-opc-connection-substitute-url.png?alt=media" alt="The Ignition 8.1 connection wizard step Specify an Alternate Discovery URL, with Substitute URL From Discovery set to the device IP address"><figcaption><p>Ignition offers the IP address in place of the device hostname.</p></figcaption></figure>

   On "Manage Certificate", set "Trust certificate?" to "Yes".

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-638c8bc5d62881189a4a69810f308e735b0eb33e%2Fignition-opc-connection-trust-certificate.png?alt=media" alt="The Manage Certificate step showing the Roboflow OPC UA Server certificate with Trust certificate set to Yes"><figcaption><p>Trust the device server certificate.</p></figcaption></figure>

   Click "Finish", give the connection a name (ex: `Roboflow Line 1`), and click "Create New OPC Connection". Leave "Username" and "Password" empty unless you turned on authentication. The connection's "Status" shows "Connected".

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-dc08d1e78c904a2f674e876773d553809b17e187%2Fignition-opc-connections-list.png?alt=media" alt="The Ignition OPC Connections list with a Roboflow Line 1 connection to the Roboflow device OPC UA Server showing Connected"><figcaption><p>The new connection to the device.</p></figcaption></figure>
2. To check the tags, go to "Config" > "OPC Client" > "OPC Quick Client", expand the connection, and click "\[s]" on a tag to subscribe to its value.

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-d21deda2f9e3922c47169008d4e4383d3ca02334%2Fignition-opc-quick-client.png?alt=media" alt="The Ignition OPC Quick Client with the Roboflow Line 1 connection expanded to Line1 and subscriptions showing DefectFound true, LastResult fail, and PassCount 128 with Good quality"><figcaption><p>Values the Workflow wrote, read by Ignition.</p></figcaption></figure>
3. In Designer, open "View" > "Panels" > "OPC Browser", expand the connection, and drag the tags into your tag provider in the Tag Browser.

   <figure><img src="https://1126624165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoO0Ceoy9R0lHDZATcPyh%2Fuploads%2Fgit-blob-ef40928983f9cfdf27667f072bcd9f99e5784aed%2Fignition-designer-opc-browser.png?alt=media" alt="The Ignition Designer OPC Browser panel with Roboflow Line 1 expanded to the Line1 folder and its DefectFound, LastResult, and PassCount tags" width="300"><figcaption><p>The device tags in Designer.</p></figcaption></figure>

The server accepts anonymous connections by default. Turn on "Require Authentication" in "Configure OPC UA Server", then use that username and password in both the Writer Sink and the Ignition connection. Every client holds one session, including each stream that writes tags, so raise "Max Sessions" if many streams and SCADA clients share one server. Learn more about the [OPC UA Server](https://docs.roboflow.com/deployment/self-hosted/enterprise/deployment-manager/services/opc-ua-server).

## Troubleshooting

<table data-search="false"><thead><tr><th>Symptom</th><th>Cause</th><th>Fix</th></tr></thead><tbody><tr><td>Device logs <code>BadNodeIdUnknown</code> when writing to the Roboflow OPC UA Server</td><td>"Node Lookup Mode" is "direct"</td><td>Set "Node Lookup Mode" to "hierarchical"</td></tr><tr><td>The Roboflow OPC UA Server keeps restarting</td><td>Its configuration has no tags, and the log shows <code>OPCUA_CONFIG 'tags' array cannot be empty</code></td><td>Add at least one tag in "Configure OPC UA Server"</td></tr><tr><td>Ignition cannot connect to the Roboflow OPC UA Server</td><td>The server reached "Max Sessions" and refuses new clients with <code>BadTooManySessions</code></td><td>Raise "Max Sessions", and add an "OPC UA Refusing Clients" device alert</td></tr></tbody></table>
