> For the complete documentation index, see [llms.txt](https://docs.augelab.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.augelab.com/function-blocks/blocks-reference/input-output/communication/opc-ua-write.md).

# OPC UA Write

This function block sends a value to an OPC UA server address using the provided client connection. Use it to update remote variables from your scenario with a selectable data type.

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

`Client` OPC UA client instance to use for the write operation (typically provided by the `OPC UA Client` block)

`Node Address` The target node address on the OPC UA server where the value will be written

`Value` The value to send to the target node

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

This function block does not provide outputs.

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

`Data type` Dropdown to select the OPC UA variant type used when writing the value. Common selectable types include Float, Boolean, Integer variants, Double and String.

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

* Write with explicit data type selection so the target variable receives the expected type.
* Works with an external OPC UA client instance to keep connectivity management separate.
* Minimal UI: only requires the inputs and the data type selection for operation.

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

When the block is evaluated during a scenario run and the three inputs are provided, it will attempt to send the given `Value` to the specified `Node Address` using the supplied `Client` connection and the chosen `Data type`. Ensure the client is connected and the address is valid before running to avoid write failures.

## 📝 Usage instructions <a href="#usage" id="usage"></a>

1. Add and configure an `OPC UA Client` block to establish and manage the server connection.
2. Provide the client output into the `Client` input.
3. Set the target node address into the `Node Address` input.
4. Provide the data to write into the `Value` input.
5. Select the appropriate `Data type` from the dropdown that matches the server variable type.
6. Run the scenario or gate the write with a logic signal so writes happen only when desired.

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

* Use the `OPC UA Client` block together with this block to manage connection lifecycle and reuse the same client for reads and writes.
* Pair with the `OPC UA Read` block to verify current values before writing or to implement read-verify-write flows.
* Use a `Logic Input` block to trigger writes only when a condition is met (for example, write on a button press or when a measurement exceeds a threshold).
* Store or log values with `Data Write Global` / `Data Write Local` or export with `CSV Export` to keep an audit trail of writes.
* When writing numeric values, prefer selecting the matching integer/float `Data type` to avoid type conversion errors on the server.

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

* No client provided: make sure the `Client` input is connected (use the `OPC UA Client` block).
* Connection errors: confirm the OPC UA client block shows a successful connection to the server before attempting writes.
* Wrong address: verify the `Node Address` string is the exact address expected by the server.
* Type mismatch: if the server rejects the value, try switching the `Data type` to the exact type of the target variable (e.g., Float vs Double, correct integer size).
* Control unwanted writes: gate the input with a `Logic Input` or other logic blocks so writes only occur when intended.
