Closed MarekS4P closed 1 year ago
It should work with BaseEvent if event type is done correctly and event notifier is notifying events to server it "should" work.
There was Lady from Siemens and she made some event extension. I´m not sure if it is available from the nodered.org flows.
Yes, it is basically working, but there are not all the data in the returned Node-RED message object. I am missing extended values of extended events. All known BaseEventType values are presented.
UAExpert received event details with all values:
Two message objects from Node-RED with the identical EventId "0xf58e368ac5fe1144b5dd2c14645733b7", but only with BaseEventType values:
There's own definition for event fields. I will check if it can be extended somehow.
In principle it should be enough to inject to client node correct message with eventTypeId and eventFields and eventFilter. Can you find out your event TypeId and event Fields?
Inject node and these are needed inside msg connected to client node with "Action EVENTS": msg.topic = node.root; // example: ns=0;i=85; msg.eventFilter = eventFilter; msg.eventFields = basicEventFields; msg.eventTypeIds = node.eventtype; // example: ns=0;i=10751;
You can debug it this way, Debug node above A & C node:
I tried it but without success. I extended msg but Node-Red throws an exception.
Code:
msg.topic = "ns=4;s=38000404"; msg.eventTypeIds = "i=2041"; msg.eventFilter.selectClauses.push( { "typeDefinitionId": "ns=0;i=2041", "browsePath": [ { "namespaceIndex": 4, "name": "InjectionUnitCycleParameters_1/4:TransferSpecificPressure" } ], "attributeId": 13, "indexRange": "NumericRange:<Empty>" }); msg.eventFields.push("4:InjectionUnitCycleParameters_1/4:TransferSpecificPressure"); return msg;
Exception:
I did the same by extending the opcua-basics.js file function "module.exports.getBasicEventFields = function ()" with "4:InjectionUnitCycleParameters_1/4:TransferSpecificPressure".
I restarted Node-Red and I had the new value in the msg:
It looks better, but this is also not working. Maybe it is because there is a composite BrowsePath "4:InjectionUnitCycleParameters_1/4:TransferSpecificPressure" created from two parts: "4:InjectionUnitCycleParameters_1" and "4:TransferSpecificPressure". Is this supported? If not, how can I declare it properly?
Hello @MarekS4P I also work with an OPC UA server (EUROMAP77) with node red, and I can't get the events.. Have you found the solution in the meantime ?
Hello @simon0168,
yes, I have a solution for the node-red-contrib-opcua version 0.2.270 with NodeJs14 and Node-RED 2.2.2
You have to edit the mentioned opcua-basics.js file.
For example the TransferSpecificPressure value will be declared like this:
["4:InjectionUnitCycleParameters_1", "4:TransferSpecificPressure"]
Hi guys, don't know exactly what you are doing, but meanwhile there is support for custom events out of the box. You will automatically get all fields of the event. (it worked some time ago, did not recheck).
Just click custom event, and add the node-id of the event-type. For standard opc ua events i=xx is enough for real custom one you need the namespace as well. Like for example ns=2;i=55.
Hi @Koseng,
thank you for your comment. This is a new feature that I did not have. We used one year ago the node-red-contrib-opcua@0.2.270
This is how the old configuration window looks like:
I will try it with the last version 0.2.305 and provide feedback.
Hi guys,
I can confirm that the new feature works. Now it is possible to define an own Event Type direct in Node-RED and no opcua-basics.js file modifications are needed.
Received event:
Thanks @Koseng @MarekS4P. I couldn't try custom event because Node-RED crashes when I use it, maybe it's because I tried to reach wrong or non-existent nodes.. I will try at work tomorrow.
@MarekS4P great that it works. Yeah it was implemented not too long ago.
Hello @MarekS4P & @Koseng, I tried this:
Hi guys, I can confirm that the new feature works. Now it is possible to define an own Event Type direct in Node-RED and no opcua-basics.js file modifications are needed.
Received event:
But in my payload I just have the message "New cycle" without CurrentLotName, CushionVolume etc., here is my payload: { "payload": { "EventId": "0xb20be6cc6a7e364c9401d8345bc413b0", "_EventId": { "dataType": "ByteString", "arrayType": "Scalar", "value": [178,11,230,204,106,126,54,76,148,1,216,52,91,196,19,176] }, "EventType": "ns=4;i=7116", "SourceNode": "ns=4;s=38621799", "SourceName": "IMM_KRAUSSMAFFEI_38621799", "Time": "2023-05-10T08:47:04.910Z", "ReceiveTime": "2023-05-10T08:47:05.176Z", "Message": { "locale": null, "text": "New Cycle" }, "Severity": 100 }, "topic": "ns=4;i=7116", "_msgid": "754864e6784a9102" }
In UaExpert if I want to retreve all "cyclic" informations I have to manually tick "SimpleEvents" in Event View and then Apply. Then With every NewCycle Event comes all informations I need (CushionVolume, CushionStroke, etc..).
Is there a way in nodeRED to "tick" SimpleEvent..?
Hi guys, I can confirm that the new feature works. Now it is possible to define an own Event Type direct in Node-RED and no opcua-basics.js file modifications are needed.
Received event:
Can you share the flow and tell me witch versions are you using? I have the same event type but no success to read anything.
Hi @yayitazale, I tested it with node-red-contrib-opcua@0.2.305 and Node-RED 2.2.2. I do not have the test flow anymore.
Hi @yayitazale, I tested it with node-red-contrib-opcua@0.2.305 and Node-RED 2.2.2. I do not have the test flow anymore.
Thanks, finally with the help of Mika we make it.
Hello @mikakaraila,
I am trying to use OPC UA Events, but there are "only" default types:
![image](https://user-images.githubusercontent.com/102301857/159925925-22a94401-04dc-4fc6-a588-dbb00cf4a482.png)
I have a OPC UA Server with custom events, which extends the BaseEventType. In this case, I will get only the known fields of the BaseEventType. All the event extensions are suppressed. Here is a screenshot with an event hierarchy in UAExpert OPC UA Client:![image](https://user-images.githubusercontent.com/102301857/159927055-f46b3c03-61d2-44d2-b110-3a87c8a4c974.png)
Is it possible to discover the OPC UA Root Node for all events and select only relevant values? Here is an example of selecting events in UAExpert:![image](https://user-images.githubusercontent.com/102301857/159928719-154205f0-2f35-4db6-b946-85696109ecca.png)
Or do I need to modify the opcua-basics.js file?