BiancoRoyal / node-red-contrib-iiot-opcua

deprecated - very new developed by PLUS for Node-RED - https://plus4nodered.com
https://www.npmjs.com/package/node-red-contrib-iiot-opcua
BSD 3-Clause "New" or "Revised" License
34 stars 8 forks source link

Beckoff connection problems #201

Closed FluffyPancakeLove closed 1 year ago

FluffyPancakeLove commented 1 year ago

Which node-red-contrib-iiot-opcua version are you using?

3.12.0

What happened?

Hello,

i am currently developing a Dashboard used in order to gather data from a Beckoff PLC. I have tried to use the instructions on Monday and they worked correctly. Unfortunately today the instructions do not work anymore (i think that this could be a certificate related problem).

This is the setting up of the connection node image

As attachment you will find the flow. [ { "id": "74c1dc72.418be4", "type": "tab", "label": "Flow 1", "disabled": false, "info": "" }, { "id": "7cac7d5d.8be724", "type": "OPCUA-IIoT-Write", "z": "74c1dc72.418be4", "connector": "21a23153.03bd6e", "name": "", "justValue": false, "showStatusActivities": false, "showErrors": false, "x": 730, "y": 280, "wires": [ [ "58b4a36a.7687ac" ] ] }, { "id": "61098c1.80e4074", "type": "OPCUA-IIoT-Inject", "z": "74c1dc72.418be4", "injectType": "write", "payloadType": "bool", "topic": "", "repeat": "", "crontab": "", "once": false, "startDelay": "", "name": "", "payload": "true", "addressSpaceItems": [ { "name": "", "nodeId": "ns=4;s=.MachineRunning", "datatypeName": "" } ], "x": 170, "y": 280, "wires": [ [ "2988b5cb.9a742a" ] ] }, { "id": "58b4a36a.7687ac", "type": "debug", "z": "74c1dc72.418be4", "name": "write", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "x": 1089, "y": 280, "wires": [] }, { "id": "2988b5cb.9a742a", "type": "OPCUA-IIoT-Node", "z": "74c1dc72.418be4", "injectType": "write", "nodeId": "ns=4;s=.MachineRunning", "datatype": "Boolean", "value": "", "name": "", "topic": "", "showErrors": true, "x": 470, "y": 280, "wires": [ [ "7cac7d5d.8be724" ] ] }, { "id": "929f873e.19e058", "type": "OPCUA-IIoT-Inject", "z": "74c1dc72.418be4", "injectType": "read", "payloadType": "date", "topic": "", "repeat": "", "crontab": "", "once": false, "startDelay": "", "name": "", "payload": "", "addressSpaceItems": [ { "name": "", "nodeId": "ns=4;s=.NumeroPezzi", "datatypeName": "" } ], "x": 180, "y": 120, "wires": [ [ "1765c719.0df299" ] ] }, { "id": "9e8a1af.d631fe8", "type": "debug", "z": "74c1dc72.418be4", "name": "read11", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "x": 1088, "y": 120, "wires": [] }, { "id": "1765c719.0df299", "type": "OPCUA-IIoT-Node", "z": "74c1dc72.418be4", "injectType": "read", "nodeId": "ns=4;s=.NumeroPezzi", "datatype": "Int16", "value": "", "name": "", "topic": "", "showErrors": true, "x": 470, "y": 120, "wires": [ [ "90028d1d.8fc74" ] ] }, { "id": "90028d1d.8fc74", "type": "OPCUA-IIoT-Read", "z": "74c1dc72.418be4", "attributeId": 0, "maxAge": 1, "depth": 1, "connector": "21a23153.03bd6e", "name": "", "justValue": true, "showStatusActivities": true, "showErrors": true, "parseStrings": false, "historyDays": 1, "serverMaxItemsToRead": 1000, "x": 730, "y": 120, "wires": [ [ "9e8a1af.d631fe8" ] ] }, { "id": "21a23153.03bd6e", "type": "OPCUA-IIoT-Connector", "z": "", "discoveryUrl": "", "endpoint": "opc.tcp://192.168.10.191:4840/", "keepSessionAlive": true, "loginEnabled": false, "securityPolicy": "Basic256Sha256", "securityMode": "SIGNANDENCRYPT", "name": "beckoff_ok", "showErrors": true, "individualCerts": false, "publicCertificateFile": "", "privateKeyFile": "", "defaultSecureTokenLifetime": "", "endpointMustExist": false, "autoSelectRightEndpoint": false, "strategyMaxRetry": "", "strategyInitialDelay": "", "strategyMaxDelay": "", "strategyRandomisationFactor": "", "requestedSessionTimeout": "", "connectionStartDelay": "", "reconnectDelay": "", "maxBadSessionRequests": "10" } ] I have checked via UaExpert that the variables are correctly published. From UaExpert i am able to see that the variables are inside the following directory : Root->Objects -> PLC1 ->variables

The error that the node gives me is ""Error: Client Not SESSIONACTIVE On Read""

Can you help me with this?

Server

Other/External server

How can this be reproduced?

As described above

What did you expect to happen?

I expected to have a solid connection as previously happened.

Other Information

No response

biancode commented 1 year ago

Hi @FluffyPancakeLove,

"{"name":"Error","message":"Client Not SESSIONACTIVE On Read"}" - this happens if you request an OPC UA service to fast to the server or without a working connection.

biancode commented 1 year ago

Screenshot_2022-10-17_09-47-22 your flow should look like this without the server

biancode commented 1 year ago

Screenshot_2022-10-17_10-04-53 or your flow should look like this without the server - the AddressSpaceItem is in the inject for the read - the write can use the Node to set the value to write, but it can work without the Node, too. Read the help of the inject node to learn more.

biancode commented 1 year ago

Screenshot_2022-10-17_10-19-36 more options are available ... happy wiring

biancode commented 1 year ago

We working on a version 4.1 - we found a lot issues after the TS merge, which are to be fixed soon.

FluffyPancakeLove commented 1 year ago

Hello @biancode !

Thank you for the code suggestions. In order to check if the publishing of the data on the server was correct, i have tried to use UAExpert and it was working.

the setup i have is this:

I have tried your suggestion but unfortunately i keep getting the proposed error.

The only solution that seems working for me (and Beckoff) right now is to implements an ADS type of connection.

The thing that could look a bit amazing is that if i use the same node (node-red-contrib-iiot-opcua) with another Codesys3 based PLC everything works perfectly (never had these issues that, in my case, take place only with a Beckoff PLC).

Hope that this could help

Hi @FluffyPancakeLove,

"{"name":"Error","message":"Client Not SESSIONACTIVE On Read"}" - this happens if you request an OPC UA service to fast to the server or without a working connection.

biancode commented 1 year ago

Hello @FluffyPancakeLove , maybe there is a mechanism to move created certs inside the Beckhoff PLC to the folder PKI/trusted from PKI/rejected or there is an option to accept certs to trusted in the PLC or you have to use an individual cert to get it working. First start with security none/none and later to secure it. The message of the session is just from the situation of a missing connection on a service request as I understand it so far.

biancode commented 1 year ago

to complete this issue here a configured default for PLCs

Beckhoff.json.zip

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. It will be closed in 15 days, but can be saved by removing the stale label or commenting.