# Timestamp on value read form OPC UA

**URL:** <https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599>\
**Category:** General\
**Created:** [12 February 2020 14:14 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599 "2020-02-12T14:14:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![athyc13](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@athyc13](https://discourse.nodered.org/u/athyc13)\
**Post date:** [12 February 2020 14:14 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/1 "2020-02-12T14:14:53Z")

</div>

Hi

Im trying to log some data from a OPC server, i got the data flowing but i need a timestamp to keep track of the order. Just like UaExpert (gives server and client time).  
In what direction should i look? i have tried the OPCUA-Item from the "node-red-contrib-opcua" since it got the DateTime type, but it just sends me the value.

Thanks.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 February 2020 14:29 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/2 "2020-02-12T14:29:03Z")

</div>

Attach a debug node to the output with "Complete msg" set as the output  
Look in the sidebar (expand the msg) - anything?

---

<div class="post-metadata">

**Author:** ![athyc13](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@athyc13](https://discourse.nodered.org/u/athyc13)\
**Post date:** [13 February 2020 06:40 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/3 "2020-02-13T06:40:45Z")

</div>

Sorry for the late reply!

This is the msg from the debug.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/6/26f2195246940a346ab83c79a23181075bc24b09.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e56e3ec22a28ae772e02bc14cdf535394ac6caea.png)

The tag dose not have the time. but surly I can add it some how?  
both server and client time.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 February 2020 07:11 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/4 "2020-02-13T07:11:21Z")

</div>

I use listener and response nodes. There's a lot more in the debug output than that. What are you using ?

---

<div class="post-metadata">

**Author:** ![athyc13](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@athyc13](https://discourse.nodered.org/u/athyc13)\
**Post date:** [13 February 2020 07:45 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/5 "2020-02-13T07:45:50Z")

</div>

My flow looks like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f549bba1fb0a767cf7fb610b43be83d573eaa7b0.png)

I added a few more tags on the server and was able to get the time. But i still need the client time.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 February 2020 09:19 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/6 "2020-02-14T09:19:32Z")

</div>

Ah, now I understand, you are using the other OPCUA library.

I use `node-red-contrib-iiot-opcua` and get far more info...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/9/0994969f780e693bb510afabe5fb1747149ccfda.png)

You could switch libraries & take advantage of the additional features?

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [15 February 2020 06:03 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/7 "2020-02-15T06:03:15Z")

</div>

Pass the output of the OPCUA node to a `change` node, and set some field like `msg.timestamp` to the current timestamp -- or am i missing something?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [15 February 2020 07:48 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/8 "2020-02-15T07:48:34Z")

</div>

Yes, time of reading ! = Time of value change.

Consider you connect to an OPC at 08:00 - the value of a TAG may have changed at 03:55 - sometimes this is knowledge is important.

---

<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:** [15 April 2020 07:48 UTC](https://discourse.nodered.org/t/timestamp-on-value-read-form-opc-ua/21599/9 "2020-04-15T07:48:42Z")

</div>

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