OPC UA Service
Integrate OPC Client to the West Connectivity
Operations
Configuration parameters
Please note that bold arguments are required, while italic arguments are optional.
Name | Type | Description |
---|---|---|
opc_server_list | [ object ] | A list of OPC server. Default: [] |
opc_server_list[].security | object | Usr/Pwd option needs to use the certificate to connect. Using security policy none (anonymous) connection if the user or password is empty. |
opc_server_list[].security.user | string | - |
opc_server_list[].security.password | string(password) | - |
opc_server_list[].server_name | string | Name of OPC server (Duplicate server names are not allowed in the system.) |
opc_server_list[].device_segment | "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" | How many segments in the identifier mapping to device Id. Example: Default: 1 |
opc_server_list[].server_address | string | Address and port of OPC server. |
opc_server_list[].subscription_nodes | object | List of subscription nodes. |
opc_server_list[].subscription_nodes.nodeId_list | [ object ] | NodeId format: ns= |
opc_server_list[].subscription_nodes.nodeId_list[].nodeId | string | - |
opc_server_list[].subscription_nodes.nodeId_list[].signal_type | "string", "number", "boolean" | - Default: "string" |
opc_server_list[].subscription_nodes.customized_nodeId_list | [ object ] | Customized device Id and signal Id. nodeId format: ns= |
opc_server_list[].subscription_nodes.customized_nodeId_list[].nodeId | string | - |
opc_server_list[].subscription_nodes.customized_nodeId_list[].deviceId | string | - |
opc_server_list[].subscription_nodes.customized_nodeId_list[].signalId | string | - |
opc_server_list[].subscription_nodes.customized_nodeId_list[].signal_type | "string", "number", "boolean" | - Default: "string" |
certificate | string | - Default: "-----BEGIN CERTIFICATE-----\nMIIEBjCCAu6gAwIBAgIUDEibbpAEdwI9xpWr2qMrSQMuSwswDQYJKoZIhvcNAQEL\nBQAwVDELMAkGA1UEBhMCREUxDTALBgNVBAcMBEhlcmUxEjAQBgNVBAoMCW9wZW42\nMjU0MTEiMCAGA1UEAwwZb3BlbjYyNTQxU2VydmVyQGxvY2FsaG9zdDAeFw0yMzEx\nMDEwNzQ0MzRaFw00MzEwMjcwNzQ0MzRaMFQxCzAJBgNVBAYTAkRFMQ0wCwYDVQQH\nDARIZXJlMRIwEAYDVQQKDAlvc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RcLrONjgihNP\nr9cTd1v8SWzNIIb3EexARUITY0nrdqRmJAI=\n-----END CERTIFICATE-----" |
Operations
Please note that bold arguments are required, while italic arguments are optional.
browse
browse the nodes from opc server.
SRS-ID: S-OPCUA-INT-004
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
nodeId | string | NodeId. also can use 'object' Default: "object" |
opc_server | object | Opcua server info. |
opc_server.security | object | Using none security connection if the user or password is empty |
opc_server.security.user | string | - |
opc_server.security.password | string(password) | - |
opc_server.server_address | string | Address and port of OPC server. |
Responses
Code | Body Type | Description |
---|---|---|
200 | nil | Opc service browse successfully |
400 | nil | Failed. |
404 | nil | Api not found. |
504 | nil | OPC-UA server timeout. |
Example
-- Can get the server info from service config page
local params = Config.getParameters({service="opcua"}).parameters
if next(params.opc_server_list) == nil then
return "No server configured"
end
local opc_server = {
['server_address'] = params.opc_server_list[1].server_address
}
-- Can get nodeId from parameter
local resp = Opcua.browse({
opc_server = opc_server,
nodeId = request.parameters.nodeid
})
return resp.result or resp
getClientState
Get the client state from opcua service.
SRS-ID: S-OPCUA-INT-002
Responses
Code | Body Type | Description |
---|---|---|
200 | [ object ] | The opcua client state of the context. |
404 | nil | Api not found. |
Object Parameter of 200 response:
Name | Type | Description |
---|---|---|
node | string | Handle by which node in the cluster |
server_name | string | Server name in service config |
connection_state | "init", "connected", "disconnect" | Opcua client state |
Example
read
read the values from the nodes
-- Example of body:
{
"opc_server":{"server_address": <server address>},
"node_list":
[<nodeId1>, <nodeId2>, <nodeId3>, ......]
}
SRS-ID: S-OPCUA-INT-004
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
node_list | [ string ] | List of nodeId |
opc_server | object | Opcua server info. |
opc_server.security | object | Using none security connection if the user or password is empty |
opc_server.security.user | string | - |
opc_server.security.password | string(password) | - |
opc_server.server_address | string | Address and port of OPC server. |
Responses
Code | Body Type | Description |
---|---|---|
200 | nil | Opc service read successfully |
400 | nil | Failed. |
404 | nil | Api not found. |
504 | nil | OPC-UA server timeout. |
Example
write
write the values to the nodes
-- Example of body:
{
"opc_server":{"server_address": <server address>},
"node_list":
[{"nodeId": <nodeId1>, "value": <value1>},
{"nodeId": <nodeId2>, "value": <value2>},
......
]
}
SRS-ID: S-OPCUA-INT-004
Arguments
parameters (object) - Object containing service call parameters.
Name | Type | Description |
---|---|---|
node_list | [ object ] | List of nodeId and writevalue |
node_list[].value | string, number, boolean | Write value |
node_list[].nodeId | string | NodeId. |
opc_server | object | Opcua server info. |
opc_server.security | object | Using none security connection if the user or password is empty |
opc_server.security.user | string | - |
opc_server.security.password | string(password) | - |
opc_server.server_address | string | Address and port of OPC server. |
Responses
Code | Body Type | Description |
---|---|---|
200 | nil | Opc service write successfully |
400 | nil | Failed. |
404 | nil | Api not found. |
504 | nil | OPC-UA server timeout. |
Example
Service Health Check
Operations
/api/v1/health
Enable the hosting system to check if service is active and running
SRS-ID: S-OPCUA-INT-001
Arguments
No Content
Responses
Name | Type | Description |
---|---|---|
200 | string | OK |
Errors
No content