Open wjomo opened 1 year ago
I expect it has something to do with the error message. I will take a look...
Hi Mika, thanks for your answer.
I have tested a little bit and tried to send msg.action = connect and msg.topic = Connect in my function node for the dynamic endpoint. After that the client node was connected with the endpoint.
But I have a problem and I don t know what is the best way to solve that.
In my application I am using two client nodes witch are connected to external OPC-UA servers witch are running on two different PLCs. Now its the problem when an machine is switched off during active reading my opc client gets an error. If the machine is switch on the opc client should automatically reconnect to the OPC Server on the PLC.
Now I dont know what is the best way to close the session when the external OPC-UA Server is not reachable without error messages and build up an connection to the server, when the PLC is started?
I hope you can give me some advices how I could do that.
Thanks for your help an have an nice day
Best Regards
There are two cases client will give warning: "No session to close!"
First one will come if client will start to reconnect and there is no active session (you case most probably). Client will loop reconnect.
Second one comes if you send action "disconnect" and there is no active session.
My proposal is to send action disconnect then client should not continue to reconnect server.
Hi Mika, thanks for the advice.
I do some test with connect, disconnect the OPC UA client node.
My test procedure was as follows:
After that I get following debug messages:
With the first error message from client node I detect the broken connection, then I sent the msg.action= disconnect.
The client node throws that error three times. After that many of errors will shown with the same payload: " Client node error on: read Client 2 error: ["read Client 2 error at active reading: Invalid Channel Bad ConnectionClosed"]"
After that errors, the client node changed the status to "disconnected"
When the client node gets the status of "disconnected" I switched on the PLC with the OPC Server and sent the msg.action=connect to the client node, then the connection is established again.
What does the high number of error messages mean? Did I controlled something wrong?
Do you prefer another workaround for detecting the lost connection, disconnect an connect the client node when a connection is possible?
The syslog entry from my node-red device shows the following messages:
Thanks for your help an have an nice day.
Best regards
Normally connection break will be handled by node-opcua. But in this case as server is most probably restarted it cannot re-connect as server forces it to re-create connection & session. Your workaround is perhaps the only way to get client connected again if normal node-opcua re-connect is not working.
I go also this problem, using credentials dynamically or by using program to change the opc endpoint,. I got always alarm. this is what I do: msg.topic="Reconnect"; msg.action="reconnect"; msg.OpcUaEndpoint = { credentials: {}, endpoint: 'opc.tcp://192.168.178.47:4840', securityPolicy: 'None', securityMode: 'None', login: true, userName: 'admin', password: 'admin' }
return msg;
Try: credentials: { user: 'admin', password: 'admin'},
This seems to be coded a different way than it should be...
Hi kbucsit22,
i pass the following Object to the client node and I am able to get a connection.
msg.topic="Reconnect";
msg.action="reconnect";
opcUAEndpoint: {
credentials: {},
endpoint: "opc.tcp://xxx.xxx.xxx.xxx:4840",
securityPolicy: "None",
securityMode: "None",
login: true,
user: "admin",
password: "password"
}
I think Mika is correct in his assumption.
Best Regards
Thank you sir, now I got it connected,. What about if I needed to disconnect it, what command I need to use?
I think you have to send:
msg.action = "disconnect";
msg.topic = "disconnect";
and to establish a connection:
msg.action = "connect";
msg.topic = "connect";
Best regards
I think you have to send:
msg.action = "disconnect"; msg.topic = "disconnect";
and to establish a connection:
msg.action = "connect"; msg.topic = "connect";
Best regards
@mikakaraila @wjomo Thank you for your big help, now I can place the IP to dashboard and user can connect or disconnect..
opc.tcp://xxx.xxx.xxx.xxx:4840
Why this does not work in docker? is it because its a linux environment?
I am not Docker expert but you should open port that it is visible on host and Docker application.
Hi Mika, thanks for your great work with the opc ua nodes.
I have updated my nodes to v0.2.298 now I have problems with injecting the client endpoint by a message. Before I did this update the dynamic endpoint works fine.
With a function node I create the following message:
If I send that object to the client node the debug shows the following message and the client node says "no client":
My test-flow for the client node looks like this:
I hope that you can help me with that problem.
Thanks for your help an have an nice day.
Best regards