# OPC UA Read

This function block reads a value from an OPC UA server address and returns the current value for use elsewhere in your scenario. It is intended for simple, synchronous reads when you already have an active client connection.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

* `Client` — input socket that accepts an active OPC UA client connection.
* `Node Address` — input socket that accepts the address/identifier of the variable to read on the server.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

* `Value` — output socket that provides the current value read from the given OPC UA address.

## 🕹️ Controls <a href="#controls" id="controls"></a>

* This block does not expose additional on-block widgets. The two input sockets (`Client` and `Node Address`) act as the controls: supply a connected client and the address to read.

## 🎯 Features <a href="#features" id="features"></a>

* Simple synchronous read of a single OPC UA address on evaluation.
* Minimal interface: only requires an active client and a node address.
* Returns the retrieved value directly through the `Value` output for downstream processing.
* Logs errors to help diagnose connectivity or address issues.

## ⚙️ Running mechanism <a href="#running-mechanism" id="running-mechanism"></a>

When the block runs, it expects an active OPC UA client on the `Client` input and a valid server variable identifier on the `Node Address` input. The block requests the current value from that address and delivers it on the `Value` output so other blocks can consume or log it.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

* To obtain a usable `Client`, first use the `OPC UA Client` block and connect its `Client` output to this block's `Client` input.
* To inspect or debug read results, connect this block's `Value` output to `Debug Input` or to `CSV Export` to record values over time.
* Use `Data Write Global` / `Data Read Global` to share read values across different parts of your scenario.
* Forward read values to external systems by connecting to `MQTT Publish` or `REST API - Post` blocks.
* If you will read many addresses regularly, consider grouping or sequencing reads with logical blocks (for example, use flow-control or batching blocks) to keep your scenario organized.

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

* No value returned / error about client: ensure the `Client` input is a connected OPC UA client (use the `OPC UA Client` block).
* Invalid address or unexpected value: verify the format and exact identifier of the `Node Address` on your OPC UA server.
* Permission or security errors: check server access rights and client security policies; ensure credentials and server settings are correct.
* Intermittent connectivity: network issues or server load can cause read failures — monitor logs and retry as needed.
* For visibility, connect the `Value` output to `Debug Input` while developing to see raw results and aid diagnosis.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.augelab.com/function-blocks/input-output/communication/opc-ua-read.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
