Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
alannoote96
@alannoote96
Error: cannot find version block
    at readTbsCertificate...
alannoote96
@alannoote96
Found the problem, had to use
import {
    readCertificate,
    readPrivateKeyPEM
} from 'node-opcua-crypto'
Punid Ramesh
@punidramesh
Hi, is there any way to increase the speed of reading variables from a server using client via ClientMonitoredItemGroup? My goal is to monitor 80,000 nodes but it takes atleast 1 second to process 2 nodes via the on changed event
Rien Verbeke
@RV1989
Hi is it possible to read out additional information when an alarm fires.
opcuaepert.png
in the siemens opcua server for S1500 these additionaltext field are represented as "@1%s@" in the alarm message. How should I read this from the client this to integrate these additionalText fields in the alarm message?
Andreas Heine
@AndreasHeine
Matthias Max
@bitflower

Hi together, hope everybody is well!

I recently starting getting "Invalid socket => Communication has been lost, cannot renew token" in my logs out of nowhere. An OPC UA server connected over a year now without issues.

Does anybody have experience with this and where it could come from?

Matthias Max
@bitflower

I'm wondering where the correct place is to listen to token renew failures in the client.

The OPCUAClient, the ClientSession or the ClientSubscription ?

I'm also missing something like isConnected or checkConnection. Context is my issue from above.

How do you handle connection loses to your OPC UA servers?

Pekka Savolainen
@sage78
Hi! I am wondering if it is possible to read historical Events (https://reference.opcfoundation.org/v104/Core/docs/Part4/5.10.3/) by using node-opcua? To me it looks that HistoryReadDetails + HistoryData only supports reading historical values, but am I missing something. An example or a pointer towards correct way of doing that would be awesome.
1 reply
Etienne
@erossignon
@sage78 you would have to use the historyRead method which comes with more flexible options. We can provide support on this to the subscriber of the NodeOPCUA membership program. Please join ( https://support.sterfive.com) or contact us directly contact@sterfive.com
Peperone97
@Peperone97
Hi all, I'm trying to write an array of objects in my node opc us server, but I'dont found any DataType to do this, how can I do it?
Andreas Heine
@AndreasHeine
what objects did you mean?
Peperone97
@Peperone97
For objects I mean something like that:
[{"var1": "value1", "var2": "value2"}, "var1": "value11", "var2": "value12"}]
Andreas Heine
@AndreasHeine
DataType.ExtensionObject (but this Structured-DataType must exist in the Server, you probably need to create it) what i am assuming you try to write a opc ua variable which holds an array of objects (ExtensionObject )?
Peperone97
@Peperone97
I was trying w/ something like this:
let test = [
    {
        "var1": "value1"
    },
    {
        "var1": "value2"
    }
]

namespace.addVariable({
    componentOf: device,
    browseName: "testArrayObject",
    dataType:'XmlElement',
    value: {
        get: function(){
            return new Variant({
                dataType: DataType.ExtensionObject,
                arrayType: VariantArrayType.Array,
                value: test
            })
        },
        set: function(variant){
            test = variant.value
            return StatusCodes.Good
        }
    } 
})

But when I startup the server I got this error, and I don't know how to solve it:
throw new Error("A variant with DataType.ExtensionObject must have a ExtensionObject value\nMake sure that you specify a valid ExtensionObject for all element of the value array passed to the Variant Constructor`");

Error: A variant with DataType.ExtensionObject must have a ExtensionObject value
Make sure that you specify a valid ExtensionObject for all element of the value array passed to the Variant Constructor`

Andreas Heine
@AndreasHeine
you need to convert the test-elements to a extensionobject each (constructExtensionObject) and then pass the list of constructed extensionobjects to the value attribute of variant class! hint: https://node-opcua.github.io/api_doc/2.32.0/classes/node_opcua.addressspace.html#constructextensionobject
Peperone97
@Peperone97

Thanks for the hint, I tried something like this:

let test = [
    new ExtensionObject(new NodeId(NodeIdType.STRING,"aaaaa",1)),
    new ExtensionObject(new NodeId(NodeIdType.STRING,"bbbbbb",2)),
]

namespace.addVariable({
    componentOf: device,
    browseName: "testArrayObject",
    dataType:'ExtensionObject',
    value: {
        get: function(){
            return new Variant({
                dataType: DataType.ExtensionObject,
                arrayType: VariantArrayType.Array,
                value: test
            })
        },
        set: function(variant){
            test = variant.value
            return StatusCodes.Good
        }
    } 
})

But I got the following error that I don't understand:
Error: String cannot be coerced to a nodeId : ExtensionObject

Andreas Heine
@AndreasHeine
again the hint was not use ExtensionObject-Class... -> addressSpace.constructExtensionObject() -> https://node-opcua.github.io/api_doc/2.32.0/classes/node_opcua.addressspace.html#constructextensionobject and as mentioned your StructuredDateType must be created first like described in https://reference.opcfoundation.org/v104/Core/docs/Part6/5.1.5/ you can only use Structures which exist in the Server!
alannoote96
@alannoote96
@AndreasHeine Hello can someone help me. I'm trying to create my own custom extensionObject in an OPC UA Server. I've read the book but it did not really help me forward. It seems like something is missing. I checked this sample: https://github.com/node-opcua/node-opcua/blob/master/packages/node-opcua-samples/bin/simple_server_with_custom_extension_objects.ts
But where do I find information on how to structure the .xml?
Andreas Heine
@AndreasHeine
@alannoote96 not sure what you try to do? What do you mean with "how to structure the .xml" did you try to create a nodeset-file?
gabrielfpvh
@gabrielfpvh
image.png
Hello everyone. I have integrated an OPCUA Server built with node-opcua with the UA Sample client (http://opcfoundation.github.io/UA-.NETStandard/help/ua_sample_client.htm ). It shows that the publish response time is equal to zero (01:00:00.000) as shown in the previous image. Has anyone seen the same behaviour? Any clue on how to fix it?
Apparently it should be stated by the server according to the opc foundation reference: https://reference.opcfoundation.org/v105/Core/docs/Part4/7.34/
Andreas Heine
@AndreasHeine
image.png
have you checked with wireshark that its really the server causing this?
@gabrielfpvh ?
gabrielfpvh
@gabrielfpvh
Thanks for your quick answer Andreas. I haven't but I will today. I'm sharing my findings ASAP. I will compare the output of UA Sample Client with UA Expert Client.
gabrielfpvh
@gabrielfpvh
Hi Andreas, you are right. Wireshark detects a correctly fulfilled timestamp and might be the client which do not process the answer correctly.
PublishResponse_Header_Timestamp.png
Thanks a lot!
Andreas Heine
@AndreasHeine
your welcome ;)
Bingpeng Xiang
@macrovve
Hello everyone, I have an OPCA server, and it will occasionally crash. However, there is no clearly error message. There are two different type error message I have got.
error: uncaughtException: Cannot read properties of null (reading 'getSubscriptionById')
TypeError: Cannot read properties of null (reading 'getSubscriptionById')
    at ServerSession.getSubscription (/home/ec2-user/opcua/node_modules/node-opcua-server/source/server_session.ts:364:49)
    at ServerSession.deleteSubscription (/home/ec2-user/opcua/node_modules/node-opcua-server/source/server_session.ts:384:38)
    at OPCUAService.<anonymous> (/home/ec2-user/opcua/node_modules/node-opcua-server/source/opcua_server.ts:2851:32)
    at Generator.next (<anonymous>)
    at fulfilled (/home/ec2-user/opcua/node_modules/node-opcua-server/dist/opcua_server.js:5:58)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {"error":{},"stack":"TypeError: Cannot read properties of null (reading 'getSubscriptionById')\n    at ServerSession.getSubscription (/home/ec2-user/opcua/node_modules/node-opcua-server/source/server_session.ts:364:49)\n    at ServerSession.deleteSubscription (/home/ec2-user/opcua/node_modules/node-opcua-server/source/server_session.ts:384:38)\n    at OPCUAService.<anonymous> (/home/ec2-user/opcua/node_modules/node-opcua-server/source/opcua_server.ts:2851:32)\n    at Generator.next (<anonymous>)\n    at fulfilled (/home/ec2-user/opcua/node_modules/node-opcua-server/dist/opcua_server.js:5:58)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)","exception":true,"date":"Thu Apr 14 2022 18:34:52 GMT+0000 (Coordinated Universal Time)","process":{"pid":3206,"uid":1000,"gid":1000,"cwd":"/home/ec2-user/opcua","execPath":"/home/ec2-user/.nvm/versions/node/v17.7.1/bin/node","version":"v17.7.1","argv":["/home/ec2-user/.nvm/versions/node/v17.7.1/bin/node","/home/ec2-user/opcua/src/app.ts","--project","tsconfig.json"],"memoryUsage":{"rss":3537960960,"heapTotal":1760063488,"heapUsed":1616525104,"external":9026125,"arrayBuffers":4235580}},"os":{"loadavg":[1.24,2.03,1.89],"uptime":2583937.26},"trace":[{"column":49,"file":"/home/ec2-user/opcua/node_modules/node-opcua-server/source/server_session.ts","function":"ServerSession.getSubscription","line":364,"method":"getSubscription","native":false},{"column":38,"file":"/home/ec2-user/opcua/node_modules/node-opcua-server/source/server_session.ts","function":"ServerSession.deleteSubscription","line":384,"method":"deleteSubscription","native":false},{"column":32,"file":"/home/ec2-user/opcua/node_modules/node-opcua-server/source/opcua_server.ts","function":null,"line":2851,"method":null,"native":false},{"column":null,"file":null,"function":"Generator.next","line":null,"method":"next","native":false},{"column":58,"file":"/home/ec2-user/opcua/node_modules/node-opcua-server/dist/opcua_server.js","function":"fulfilled","line":5,"method":null,"native":false},{"column":null,"file":null,"function":"runMicrotasks","line":null,"method":null,"native":false},{"column":5,"file":"node:internal/process/task_queues","function":"processTicksAndRejections","line":96,"method":null,"native":false}]}
error: uncaughtException: Cannot read properties of null (reading 'getSubscriptionById')
And
error: uncaughtException: (no error message)
Error:
    at Object.assert (/home/ec2-user/opcua/node_modules/node-opcua-assert/source/index.ts:14:21)
    at PacketAssembler.feed (/home/ec2-user/opcua/node_modules/node-opcua-packet-assembler/source/packet_assembler.ts:65:13)
    at ServerTCP_transport._on_socket_data (/home/ec2-user/opcua/node_modules/node-opcua-transport/source/tcp_transport.ts:388:34)
    at Socket.<anonymous> (/home/ec2-user/opcua/node_modules/node-opcua-transport/source/tcp_transport.ts:258:48)
    at Socket.emit (node:events:527:28)
    at Socket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {"error":{},"stack":"Error: \n    
    at Object.assert (/home/ec2-user/opcua/node_modules/node-opcua-assert/source/index.ts:14:21)\n    
    at PacketAssembler.feed (/home/ec2-user/opcua/node_modules/node-opcua-packet-assembler/source/packet_assembler.ts:65:13)\n    
    at ServerTCP_transport._on_socket_data (/home/ec2-user/opcua/node_modules/node-opcua-transport/source/tcp_transport.ts:388:34)\n    
    at Socket.<anonymous> (/home/ec2-user/opcua/node_modules/node-opcua-transport/source/tcp_transport.ts:258:48)\n    
    at Socket.emit (node:events:527:28)\n    at Socket.emit (node:domain:475:12)\n    at addChunk (node:internal/streams/readable:324:12)\n    
    at readableAddChunk (node:internal/streams/readable:297:9)\n    at Socket.Readable.push (node:internal/streams/readable:234:10)\n    
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)","exception":true,"date":"Sat Mar 19 2022 22:35:45 GMT+0000 (Coordinated Universal Time)","process":{"pid":2047,"uid":1000,"gid":1000,"cwd":"/home/ec2-user/opcua","execPath":"/home/ec2-user/.nvm/versions/node/v17.7.1/bin/node","version":"v17.7.1","argv":["/home/ec2-user/.nvm/versions/node/v17.7.1/bin/node","/home/ec2-user/opcua/src/app.ts","--project","tsconfig.json"],"memoryUsage":{"rss":2069454848,"heapTotal":1744777216,"heapUsed":1319926936,"external":5886967,"arrayBuffers":1374908}},"os":{"loadavg":[0.85,0.85,0.89],"uptime":351990.01},"trace":[{"column":21,"file":"/home/ec2-user/opcua/node_modules/node-opcua-assert/source/index.ts","function":"Object.assert","line":14,"method":"assert","native":false},{"column":13,"file":"/home/ec2-user/opcua/node_modules/node-opcua-packet-assembler/source/packet_assembler.ts","function":"PacketAssembler.feed","line":65,"method":"feed","native":false},{"column":34,"file":"/home/ec2-user/opcua/node_modules/node-opcua-transport/source/tcp_transport.ts","function":"ServerTCP_transport._on_socket_data","line":388,"method":"_on_socket_data","native":false},{"column":48,"file":"/home/ec2-user/opcua/node_modules/node-opcua-transport/source/tcp_transport.ts","function":null,"line":258,"method":null,"native":false},{"column":28,"file":"node:events","function":"Socket.emit","line":527,"method":"emit","native":false},{"column":12,"file":"node:domain","function":"Socket.emit","line":475,"method":"emit","native":false},{"column":12,"file":"node:internal/streams/readable","function":"addChunk","line":324,"method":null,"native":false},{"column":9,"file":"node:internal/streams/readable","function":"readableAddChunk","line":297,"method":null,"native":false},{"column":10,"file":"node:internal/streams/readable","function":"Socket.Readable.push","line":234,"method":"push","native":false},{"column":23,"file":"node:internal/stream_base_commons","function":"TCP.onStreamRead","line":190,"method":"onStreamRead","native":false}]}
ing-Hugo
@ing-Hugo
Hello, everyone, I try to connect with a server but is not possible this is the message that show me.
image.png
OPCDA.PNG
ing-Hugo
@ing-Hugo
I don't have experience with OPC-UA, but is possible to try to connect with a OPC Server with technology OPC-COM?, or what king of procedure I need to follow to achive that connection with OPC-COM.
Fabian Beitler
@swamper123
OPC-COM is not OPC UA.
So it is not possible to access that. Perhaps there are adapter products out there on the market, but there isn't sth. out of the box like as a code example afain.
afaik
Andreas Heine
@AndreasHeine
no node-opcua is not a dcom (opc classic) library ... thats two different technologies! the only way to make that work is to by a gateway which converts from opc classic to opc ua.
Andreas Heine
@AndreasHeine
the url of an opcua server starts with "opc.tcp" which is the protocol!
grahamwobig
@grahamwobig
hi all. I am working on a project where I need to use monitored item groups. I've purchased the example book but the example for monitored item group seems to be out of date. I am wondering if there is any additional resource on monitored item group. Specifically, i'm curious about the options for monitored items group? Additionally, I have a question regarding the best practice for a client. In my project, I would like to have multiple monitored item groups which are encapsulated within a class (class also needs to be able to write to these items to create async read/write behavior). Is the best practice for there to be one client with multiple sessions for each instance of my class or is it better to have one client and one session and pass that session to the instances? Lastly, any details about using a client to write would be helpful since the example book/documentation don't include any examples. Thanks in advance and please ask for clarification as needed
Harri Pirttinen
@pirtthar
Hey everyone. While traversing a node-tree with browse, I noticed that I did not get results from objects that have quotes in their node-id, for example NodeId ns=62;s="SOMETHING" . I would need to get all nodes, so could you possibly help me in understanding the problem and fixing it?
Andreas Heine
@AndreasHeine