Connect node-red on raspberry to OPC server on other PC same network

Hi everyone,
i connected node-red to OPC server same machine PC windown, but i can't connect node-red on raspberry to OPC on PC same network.
Can i help you ? what should i do ?
Thank you

You need to connect to the OPC servers URI. There are lots of details you are missing though.

1 Like

Thank you, can you guide me in detail ?

You state you can already connect, so you have the details you need.
So what happens when you configure the node with the URI of your OPC server?

Is there an error message? Is there anything in the logs?

On the machine that works
What version of Node-RED, nodejs are you using?
What node and version are you using to connect to your OPC server?

On the machine that does not work
What version of Node-RED, nodejs are you using?
What node and version are you using to connect to your OPC server?

Regarding OPC, if I remember correctly, was originally developed for Windows (later also for Linux) and had dependencies of COM and DCOM.

Since the topic author wrote it worked fine in Windows where COM and DCOM is present, there should be no surprise it worked locally in Windows

Now when trying to connect over the network, DCOM is required unless the OPC server is developed "later" so to say, i.e. is an OPC UA server

When connecting from Node-RED running on Debian in a RPi, DCOM is not available and if the OPC server is not developed recently, it will not work

It is a while back since I worked with OPC clients and servers and it was only in Windows. But I would look for a tool for Linux that is capable to find & list OPC servers on the network and see if that is able to connect and browse the server for tags and items. If this fails, I think the OPC server is a pure Windows DA implementation

1 Like

ohh, thank you very much

First check I would do is to try to run a small python program on your RPi trying OpenOPC

If you are able to find and connect to your OPC server, that is a good starting point

Have you setup OPCUA discovery in the OPC side bud? If so you should have a URI to communicate with this is what should be in your node red app

I config like image, in node red i also config

You stated that you already had it working on one machine with Node-RED.

So what did you use there? You also haven't said what contrib-node you are using...

i used node-red-contrib-iiot-opcua. i connected node red on PC window to opc kepware server on same PC, but i can't connect node red on raspberry to opc server on PC same network

so what did you configure within node-red-contrib-iiot-opcua within node-red that worked?

i configure like image

[{"id":"abc0b483.7a6558","type":"OPCUA-IIoT-Read","z":"873f820a.ceb8a","attributeId":"13","maxAge":1,"depth":1,"connector":"cd03c874.d47a18","name":"","justValue":true,"showStatusActivities":false,"showErrors":false,"parseStrings":false,"historyDays":1,"x":330,"y":244,"wires":[["ee58f1d9.7264d"]]},{"id":"cd03c874.d47a18","type":"OPCUA-IIoT-Connector","z":"","discoveryUrl":"","endpoint":"opc.tcp://","keepSessionAlive":true,"loginEnabled":false,"securityPolicy":"None","securityMode":"NONE","name":"LOCAL SERVER","showErrors":false,"individualCerts":false,"publicCertificateFile":"","privateKeyFile":"","defaultSecureTokenLifetime":"60000","endpointMustExist":false,"autoSelectRightEndpoint":false,"strategyMaxRetry":"","strategyInitialDelay":"","strategyMaxDelay":"","strategyRandomisationFactor":"","requestedSessionTimeout":"","connectionStartDelay":"","reconnectDelay":"","maxBadSessionRequests":"10"}]

So what about the FW in Windows? Did you define a rule for incoming connection?

1 Like

First check the firewall. I keep forgetting this myself from time to time. Go Windows firewall, advanced settings, incoming rule, TCP, port 49320. In Kepserver doc named UA endpoint.

1 Like

oh yeah, i'm ok

When you say you are ok, did you manage to make it work Node-RED RPi <---> OPC Server Windows ???

Since you are on OPC UA and managed to make it work locally in Windows, I think the problems with remote access over the network are related to user access rights and/or Windows firewall

I have seen that the OPC UA nodes published as "node-red-contrib-opcua" does give some good & useful debug info. I could actually see that access was denied when I tried Node-RED RPi <---> Kepware OPC Server Windows

(I did also not manage to even connect locally in the same Windows machine, for me this is not critical anyway, I'm not using OPC in any production system)

My example configuration, reading and writing using the OPC node can be found in this example if it helps: