This module implements an OPC UA client using the Viam sensor api. It allows you to connect to an OPC UA server and read/write its attributes. The module is work in progress and additional features are planned to be implemented. As always, please provide feedback and suggestions wherever applicable!
The module doesn't have any specific requirements. If you need support for another platform, let us know.
To use this module, follow the instructions to add a module from the Viam Registry and select the viam-soleng:opc-ua:opcsensor
model from the opc-ua-client module.
If you plan to modify and build it for yourself, look into check out the Makefile and have a look at Create Viam Modules.
Note
Before configuring your sensor you must create a machine.
Navigate to the Config tab of your machine's page in the Viam app.
Click on the Components subtab and click Create component.
Select the component
type, then select the opcsensor
model provided by viam-soleng.
Click Add module, then enter a name for your sensor and click Create.
On the new component panel, copy and paste the following attribute template into your sensor’s Attributes box and adjust them according to your environment:
{
"nodeids": [
"ns=2;i=3",
"ns=2;i=2"
],
"endpoint": "opc.tcp:https://0.0.0.0:4840/freeopcua/server/"
}
Note
For more information, see Configure a Machine.
The following attributes are available for <INSERT API NAMESPACE>:<INSERT API NAME>:<INSERT MODEL>
sensor's:
Name | Type | Inclusion | Description |
---|---|---|---|
nodeids |
[]string | Optional | List of node ids to be read |
endpoint |
string | Required | The opc ua server address and port |
{
"nodeids": [
"ns=2;i=3",
"ns=2;i=2"
],
"endpoint": "opc.tcp:https://0.0.0.0:4840/freeopcua/server/"
}
The OPC UA client module allows you to set nodes to certain values by using the following parameters
{
"write":{
"ns=2;i=2":100,
"ns=2;i=3":0.1
}
}
The result will provide a list of values where 0 means succesful.
Let us know any issues / limitations important to you and your project! Simply create an issue and we will get back to you. We also welcome pull requests which we will review and consider merging!
Current Known Limitations:
- No authentication
- Only reading of attributes is suppported
- Write attributes
- Authentication