Issues reading data from OPC-UA server

I keep working on an industrial application to integrate all the data of the machines in our plant for their posterior storage in a DB and process.

Until now, I'm using S7 nodes to retrieve the PLC data from a specific vendor, some http nodes with GET/POST commands to retrieve the data of the mobile robots fleet manager, and now I have to get data from another vendor who decided to use OPC-UA to offer the data.

I started with UaExpert to connect to the server. My idea was to get the node IDs and subscribe to the values I need, so I receive regular updates when the values change. I would then update the values in a global context to store the data, and regularly save those values to the DB.

The settings of the server are as such:

This is the test flow I have on node-red:
image

The inject node is using the timestamp as payload and the tag ID from UaExpert as topic:
image

The OPC UA Client node is configured like this:
image
I selected READ and not subscribe until I'm sure that I'm getting the data I want. Since the login in UaExpert is using self-certificate, I selected the same on the OPC UA client node.

However, when I deploy and node-red tries to connect, I get the following 3 output messages in the debug window:

OpcUaClientNode: Create Client: [{"securityPolicy":"1","securityMode":3,"clientCertificateManager":"2","requestedSessionTimeout":300000,"clientName":"3","endpointMustExist":false,"defaultSecureTokenLifetime":200000,"connectionStrategy":"4","keepSessionAlive":true},"http://opcfoundation.org/UA/SecurityPolicy#Basic256",{"untrustUnknownCertificate":true,"state":4,"folderPoolingInterval":5000,"_watchers":"5","_readCertificatesCalled":true,"_filenameToHash":"6","_thumbs":"7","_pending_crl_to_process":0,"queue":"8","location":"9","keySize":2048,"referenceCounter":0,"automaticallyAcceptUnknownCertificate":true},"",{"maxRetry":10512000,"initialDelay":5000,"maxDelay":30000},[],{"C:\\Users\\ferrerons\\AppData\\Roaming\\node-red-opcua-nodejs\\Config\\PKI\\trusted\\certs\\NodeOPCUA-Client@proddata[fa43bffd02fadd1eb2d18b73d95f5f39e3e76c4e].pem":"10"},{"rejected":"11","trusted":"12","issuers":"13","crl":"14","issuersCrl":"15"},[],"C:/Users/ferrerons/AppData/Roaming/node-red-opcua-nodejs/Config/PKI",...
OpcUaClientNode: Case A: Endpoint does not contain, 1==None 2==Sign 3==Sign&Encrypt securityMode:[3] securityPolicy:["http://opcfoundation.org/UA/SecurityPolicy#Basic256"]
OpcUaClientNode: Case B: UserName & password does not match to server (needed by Sign): undefined undefined

Then I added a catch node connected to a debug node with the complete msg, but it does not catch anything, and still get the same error output (and no information about the tag I was trying to read).

Any ideas on what I'm doing wrong?

Thanks in advance.

OK, this might be another case of self-solved problem.

It looked like I was doing everything correctly, but the system administrator had set the firewall to block all the ports except for a few. Turns out all the ports for OPC-UA between the node-red server and the OPC-UA server in the machine were blocked.

After the sysadmin unlocked them, I got good results:

If you're having similar problems, check that the ports are open before doing anything else, or you will waste hours of your time by looking for causes that are not there.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.