OPC UA Writer Sink¶
Class: OPCWriterSinkBlockV1
Source: inference.enterprise.workflows.enterprise_blocks.sinks.opc_writer.v1.OPCWriterSinkBlockV1
The OPC UA Writer block enables you to write data to a variable on an OPC UA server, leveraging the asyncua library for seamless communication.
Supported Data Types¶
This block supports writing the following data types to OPC UA server variables: - Numbers (integers, floats) - Booleans - Strings
Note: The data type you send must match the expected type of the target OPC UA variable.
Node Lookup Mode¶
The block supports two methods for locating OPC UA nodes via the node_lookup_mode parameter:
hierarchical(default): Uses standard OPC UA hierarchical path navigation. The block navigates through the address space usingget_child(). Each component in theobject_namepath is automatically prefixed with the namespace index.- Example:
object_name="Roboflow/Crane_11"→ path0:Objects/2:Roboflow/2:Crane_11/2:Variable -
Best for: Traditional OPC UA servers with hierarchical address spaces
-
direct: Uses direct NodeId string access. The block constructs a NodeId asns={namespace};s={object_name}/{variable_name}and accesses it directly viaget_node(). - Example:
object_name="[Sample_Tags]/Ramp"→ NodeIdns=2;s=[Sample_Tags]/Ramp/South_Person_Count - Best for: Ignition SCADA systems and other servers using string-based NodeId identifiers
Cooldown¶
To prevent excessive traffic to the OPC UA server, the block includes a cooldown_seconds parameter,
which defaults to 5 seconds. During the cooldown period:
- Consecutive executions of the block will set the throttling_status output to True.
- No data will be sent to the server.
You can customize the cooldown_seconds parameter based on your needs. Setting it to 0 disables
the cooldown entirely.
Asynchronous Execution¶
The block provides a fire_and_forget property for asynchronous execution:
- When fire_and_forget=True: The block sends data in the background, allowing the Workflow to
proceed immediately. However, the error_status output will always be set to False, so we do not
recommend this mode for debugging.
- When fire_and_forget=False: The block waits for confirmation before proceeding, ensuring errors
are captured in the error_status output.
Disabling the Block Dynamically¶
You can disable the OPC UA Writer block during execution by linking the disable_sink parameter
to a Workflow input. By providing a specific input value, you can dynamically prevent the block from
executing.
Connection Pooling¶
The block uses a connection pool to efficiently manage OPC UA connections. Instead of creating a new connection for each write operation, connections are reused across multiple writes to the same server. This significantly reduces latency and resource usage for high-frequency write scenarios.
- Connections are automatically pooled per server URL and username combination
- If a connection fails during a write operation, it is automatically invalidated and a new connection is established on the next write attempt
Retry Logic¶
The block includes configurable retry logic with exponential backoff for handling transient connection failures:
max_retries: Number of connection attempts before giving up (default: 3)retry_backoff_seconds: Base delay between retries in seconds (default: 1.0). The delay doubles after each failed attempt (exponential backoff).
Note: Authentication errors (wrong username/password) are not retried as they will continue to fail.
Cooldown Limitations¶
Cooldown Limitations
The cooldown feature is optimized for workflows involving video processing.
- In other contexts, such as Workflows triggered by HTTP services (e.g., Roboflow Hosted API,
Dedicated Deployment, or self-hosted Inference server), the cooldown timer will not be applied effectively.
Type identifier¶
Use the following identifier in step "type" field: roboflow_enterprise/opc_writer_sink@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
url |
str |
URL of the OPC UA server to which data will be written.. | ✅ |
namespace |
str |
The OPC UA namespace URI or index used to locate objects and variables.. | ✅ |
user_name |
str |
Optional username for authentication when connecting to the OPC UA server.. | ✅ |
password |
str |
Optional password for authentication when connecting to the OPC UA server.. | ✅ |
object_name |
str |
The name of the target object in the namespace to search for.. | ✅ |
variable_name |
str |
The name of the variable within the target object to be updated.. | ✅ |
value |
Union[bool, float, int, str] |
The value to be written to the target variable on the OPC UA server.. | ✅ |
value_type |
str |
The type of the value to be written to the target variable on the OPC UA server. Supported types: Boolean, Double, Float, Int16, Int32, Int64, Integer (Int64 alias), SByte, String, UInt16, UInt32, UInt64.. | ✅ |
timeout |
int |
The number of seconds to wait for a response from the OPC UA server before timing out.. | ✅ |
fire_and_forget |
bool |
Boolean flag to run the block asynchronously (True) for faster workflows or synchronously (False) for debugging and error handling.. | ✅ |
disable_sink |
bool |
Boolean flag to disable block execution.. | ✅ |
cooldown_seconds |
int |
The minimum number of seconds to wait between consecutive updates to the OPC UA server.. | ✅ |
node_lookup_mode |
str |
Method to locate the OPC UA node: 'hierarchical' uses path navigation, 'direct' uses NodeId strings (for Ignition-style string-based tags).. | ✅ |
max_retries |
int |
Maximum number of connection attempts before giving up. Default is 3 with exponential backoff starting at 15ms.. | ✅ |
retry_backoff_seconds |
float |
Base delay between retry attempts in seconds (doubles each retry). Default is 0.015 (15ms) for fast exponential backoff.. | ✅ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to OPC UA Writer Sink in version v1.
- inputs:
Roboflow Asset Library Attributes,Florence-2 Model,Email Notification,VLM As Classifier,EasyOCR,Object Detection Model,Twilio SMS Notification,Local File Sink,Pixel Color Count,Template Matching,VLM As Classifier,Qwen 3.5 API,Model Monitoring Inference Aggregator,Keypoint Detection Model,Qwen-VL,OpenAI,CogVLM,JSON Parser,Cosine Similarity,Google Vision OCR,OpenRouter,Florence-2 Model,Roboflow Dataset Upload,Qwen3.5-VL,Distance Measurement,Roboflow Vision Events,OpenAI,SIFT Comparison,S3 Sink,MoonshotAI Kimi,Twilio SMS/MMS Notification,SIFT Comparison,Google Gemini,Single-Label Classification Model,Stitch OCR Detections,Line Counter,Dynamic Zone,Webhook Sink,OCR Model,Roboflow Dataset Upload,Detection Event Log,Roboflow Custom Metadata,VLM As Detector,Gaze Detection,LMM For Classification,OpenAI-Compatible LLM,Anthropic Claude,Clip Comparison,Multi-Label Classification Model,Current Time,OpenAI,Perspective Correction,Llama 3.2 Vision,Anthropic Claude,MQTT Writer,Motion Detection,MoonshotAI Kimi,Google Gemini,Identify Changes,PTZ Tracking (ONVIF),Google Gemma,Detections Consensus,Google Gemma API,OPC UA Writer Sink,Line Counter,Slack Notification,Email Notification,LMM,Identify Outliers,Image Stack,Google Gemini,Instance Segmentation Model,Event Writer,Camera Focus,GLM-OCR,Qwen 3.6 API,Image Contours,VLM As Detector,Llama 3.2 Vision,Stitch OCR Detections,Camera Focus,CSV Formatter,OpenAI,Microsoft SQL Server Sink,Anthropic Claude - outputs:
Detections Classes Replacement,Morphological Transformation,Image Preprocessing,Email Notification,Halo Visualization,Morphological Transformation,Object Detection Model,Time in Zone,BoT-SORT Tracker,Text Display,Template Matching,Pixel Color Count,Image Threshold,Model Monitoring Inference Aggregator,Pixelate Visualization,Keypoint Detection Model,Time in Zone,Qwen-VL,OpenAI,CogVLM,Crop Visualization,SAM 3,Dot Visualization,Google Vision OCR,Florence-2 Model,Roboflow Dataset Upload,Qwen3.5-VL,Roboflow Vision Events,Polygon Zone Visualization,Polygon Visualization,S3 Sink,Twilio SMS/MMS Notification,QR Code Generator,SIFT Comparison,Single-Label Classification Model,Cache Get,Stitch OCR Detections,Dynamic Zone,Color Visualization,Roboflow Dataset Upload,Gaze Detection,Roboflow Custom Metadata,LMM For Classification,OpenAI-Compatible LLM,Line Counter Visualization,Stability AI Inpainting,Image Blur,Object Detection Model,Blur Visualization,Path Deviation,Current Time,SAM 3,Perspective Correction,Keypoint Visualization,Anthropic Claude,MQTT Writer,MoonshotAI Kimi,Google Gemini,SAM 3,Depth Estimation,Detections Consensus,Ellipse Visualization,Detections Stitch,Google Gemma API,Object Detection Model,Slack Notification,Time in Zone,Image Stack,Google Gemini,Cache Set,Bounding Box Visualization,Label Visualization,Keypoint Detection Model,Stitch OCR Detections,Size Measurement,Keypoint Detection Model,Multi-Label Classification Model,OpenAI,Perception Encoder Embedding Model,Anthropic Claude,Roboflow Asset Library Attributes,Moondream2,CLIP Embedding Model,Florence-2 Model,Seg Preview,YOLO-World Model,Multi-Label Classification Model,Segment Anything 2 Model,Twilio SMS Notification,Local File Sink,Single-Label Classification Model,Triangle Visualization,Icon Visualization,Qwen 3.5 API,Path Deviation,OpenRouter,Instance Segmentation Model,Distance Measurement,Instance Segmentation Model,OpenAI,Background Color Visualization,MoonshotAI Kimi,Google Gemini,Corner Visualization,Reference Path Visualization,Single-Label Classification Model,Line Counter,Halo Visualization,Webhook Sink,Dynamic Crop,Instance Segmentation Model,Stability AI Outpainting,Anthropic Claude,Multi-Label Classification Model,Clip Comparison,OpenAI,Llama 3.2 Vision,Motion Detection,PTZ Tracking (ONVIF),Camera Calibration,Model Comparison Visualization,Trace Visualization,Google Gemma,OPC UA Writer Sink,Line Counter,Circle Visualization,Email Notification,LMM,Event Writer,Instance Segmentation Model,Heatmap Visualization,Contrast Equalization,GLM-OCR,Qwen 3.6 API,Classification Label Visualization,Llama 3.2 Vision,Mask Visualization,Microsoft SQL Server Sink,Stability AI Image Generation,Semantic Segmentation Model,Polygon Visualization
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
OPC UA Writer Sink in version v1 has.
Bindings
-
input
url(string): URL of the OPC UA server to which data will be written..namespace(string): The OPC UA namespace URI or index used to locate objects and variables..user_name(string): Optional username for authentication when connecting to the OPC UA server..password(string): Optional password for authentication when connecting to the OPC UA server..object_name(string): The name of the target object in the namespace to search for..variable_name(string): The name of the variable within the target object to be updated..value(Union[string,float,boolean,integer]): The value to be written to the target variable on the OPC UA server..value_type(string): The type of the value to be written to the target variable on the OPC UA server. Supported types: Boolean, Double, Float, Int16, Int32, Int64, Integer (Int64 alias), SByte, String, UInt16, UInt32, UInt64..timeout(integer): The number of seconds to wait for a response from the OPC UA server before timing out..fire_and_forget(boolean): Boolean flag to run the block asynchronously (True) for faster workflows or synchronously (False) for debugging and error handling..disable_sink(boolean): Boolean flag to disable block execution..cooldown_seconds(integer): The minimum number of seconds to wait between consecutive updates to the OPC UA server..node_lookup_mode(string): Method to locate the OPC UA node: 'hierarchical' uses path navigation, 'direct' uses NodeId strings (for Ignition-style string-based tags)..max_retries(integer): Maximum number of connection attempts before giving up. Default is 3 with exponential backoff starting at 15ms..retry_backoff_seconds(float): Base delay between retry attempts in seconds (doubles each retry). Default is 0.015 (15ms) for fast exponential backoff..
-
output
Example JSON definition of step OPC UA Writer Sink in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_enterprise/opc_writer_sink@v1",
"url": "opc.tcp://localhost:4840/freeopcua/server/",
"namespace": "http://examples.freeopcua.github.io",
"user_name": "John",
"password": "secret",
"object_name": "Line1",
"variable_name": "InspectionSuccess",
"value": "running",
"value_type": "Boolean",
"timeout": 10,
"fire_and_forget": true,
"disable_sink": false,
"cooldown_seconds": 10,
"node_lookup_mode": "hierarchical",
"max_retries": 1,
"retry_backoff_seconds": 0.015
}