# Is it possible to receive customized opcua EventTypes over node-red-contrib-opcua?

**URL:** <https://discourse.nodered.org/t/is-it-possible-to-receive-customized-opcua-eventtypes-over-node-red-contrib-opcua/56518>\
**Category:** General\
**Created:** [12 January 2022 11:34 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-customized-opcua-eventtypes-over-node-red-contrib-opcua/56518 "2022-01-12T11:34:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eastling](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eastling/32/39127_2.png) [@eastling](https://discourse.nodered.org/u/eastling)\
**Post date:** [12 January 2022 11:34 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-customized-opcua-eventtypes-over-node-red-contrib-opcua/56518/1 "2022-01-12T11:34:51Z")

</div>

Hi,  
I have a similar question to Lena from this topic ( [Is it possible to receive customized OPC UA A&C EventTypes over node-red-contrib-opcua?](https://discourse.nodered.org/t/is-it-possible-to-receive-customized-opc-ua-a-c-eventtypes-over-node-red-contrib-opcua/52080) ).  
So in one of my cases I have this customized EventType "JobInfoEventType" which is a sub event class of BaseEvent(Type). In node-red-contrib-opcua its possible to select these event types:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f773e8e8bbb940dccfd80e5e62b28efb4bc43ec.png)  
So I choose "BaseEvent".  
I correctly then get the events triggered at the right time but only the information in BaseEvent is available (which probably is expected):  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/9/595c3c6c971b27ec42d019c5b17d42850d22a294.png)

My question is if its possible to get the "extra" information available in the JobInfoEventType in some way? For this event type its these 3 values : "IsTestPrint", "JobSize" and "LabelNo".

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/10cf5fb1921941888b5a8595dc494b7a64a1281b.png)

For this test flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/9/49b74389eccb4815df6ef2e21d9bcb1b097f9726.png)

The "event srtart" debug looks like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/7/a7cbfbf031f717b7470dfad7fc4dd1031eef6faf.png)

I tried modifying the message generated by "Interpreter Events" by adding field in similar structure in a function node between the "Interpreter events" and "OPC UA CONNECTION" nodes but still no success:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0f14e83547f9492de90d150fd84ca457b7c13062.png)

Would greatly appreciate any inputs on how this is supposed to be done (if its possible) witht the node-red-contrib-opcua nodes.

---

<div class="post-metadata">

**Author:** ![Lena](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lena/32/49241_2.png) [@Lena](https://discourse.nodered.org/u/Lena)\
**Post date:** [12 January 2022 15:51 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-customized-opcua-eventtypes-over-node-red-contrib-opcua/56518/2 "2022-01-12T15:51:53Z")

</div>

Hi Martin,

I didn´t find settings to receive the specific informations with this node. To get this special informations I downloaded the javascript-code of the node-red-contrib-opcua-nodes and inserted the specific type fields there...

But I am not a specialist in opc-ua or node-red, I don´t know if there is an easier way to get this new informations...

---

<div class="post-metadata">

**Author:** ![eastling](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eastling/32/39127_2.png) [@eastling](https://discourse.nodered.org/u/eastling)\
**Post date:** [17 January 2022 19:39 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-customized-opcua-eventtypes-over-node-red-contrib-opcua/56518/3 "2022-01-17T19:39:20Z")

</div>

Thanks Lena for your time answering this!  
If you or anyone else is intrested in how this can be solved without customizing node-red-contrib-opcua, see here:

> <https://github.com/mikakaraila/node-red-contrib-opcua/issues/373#issuecomment-1014838298>
>
> Hi,
> This is not an issue - only a question.
> Thanks so much for creating this c…omponent!
> 
> I am trying to subscribe to a "custom event" from a label printer called "IOStatusChangeEventType" and this event has a property called "Status" of type UInt32 which contains the intresting information.
> The event as i understand it is a subtype of the "BaseEventType" (?).
> The vendor specifies this:
> !\[image\](https://user-images.githubusercontent.com/1698898/149789765-0d72ad10-8d85-4299-91e1-120fed71a32a.png)
> https://www.cab.de/en/news/news/opcua/
> 
> Browsing in UAExpert I see the event type here:
> !\[image\](https://user-images.githubusercontent.com/1698898/149790170-9207312f-766b-4f6e-b337-0b0b4124dbbb.png)
> 
> And the event is generated by this node:
> !\[image\](https://user-images.githubusercontent.com/1698898/149790330-1813095f-1f05-4738-9635-589ee3511a43.png)
> 
> So creating a event subscription for BaseEventType on root node "ns=3;i=10006" is working to get the events triggered correctly but I cannot figure out how to get the extra information field called "Status":
> !\[image\](https://user-images.githubusercontent.com/1698898/149791228-fb69d8e3-770a-4140-96f8-a64f964473ad.png)
> 
> I have tried just pushing the status to the selectClause and eventsFields structures like so:
> !\[image\](https://user-images.githubusercontent.com/1698898/149791617-9797667d-ed6d-4b62-8940-45fe20063e5d.png)
> 
> but then I get this error leading me to think I need to specify the custom event somewhere so it can be encoded:
> D:\\path\\to\\app\\node\_modules\\node-opcua-types\\dist\\\_generated\_opcua\_types.js:10758
> (0, node\_opcua\_basic\_types\_1.encodeArray)(this.selectClauses, stream, (obj, stream1) =\> { obj.encode(stream1); });
> \*\*TypeError: obj.encode is not a function\*\*
> 
> So the question is - how can i subscribe to events of type IOStatusChangeEventType and also get the "Status" property into Node-RED?
> 
> I would appreciate any help greatly! I also aplogize if this is the wrong place to state such a question.
> Best regards,
> Martin

Regards,  
Martin

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [31 January 2022 19:39 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-customized-opcua-eventtypes-over-node-red-contrib-opcua/56518/4 "2022-01-31T19:39:46Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
