Node-red-contrib-opcua: set source timestamp

Hi,

I'm using node RED as a gateway between an API and OPC UA. Node RED receives values from API with a timestamp. I'm successfully writing values to a variable "vannstand" on opc ua server from node red, but i struggle to forward the timestamp as "sourceTimestamp" attribute. I tried different format but no one succeeded.
From blockquote under, the timestamp should be 10/07/2023, 16:00:00 [UTC+2]. Here is the payload sent to OPC UA server node:

msg.payload= {"namespace": 2, "messageType": "Variable", 
                "variableName": "Vannstand",
                "variableValue": 1.6,
                "sourceTimestamp": 1688997600000}}
return msg;

But my opc ua client shows only current time. Here is the result when injecting the node at 16:31:

Could someone tell me if opc ua server is able to receive "sourceTimestamp" attribute?

P.S: I found the solution. The problem was due to a missing attribute. By adding "quality" attribute in the payload, the OPCUA server accept "sourceTimestamp":

msg.payload= {"namespace": 2, "messageType": "Variable", 
                "variableName": "Vannstand",
                "variableValue": 1.6,
                "sourceTimestamp": 1688997600000,
                "quality": "Good"}}
return msg;

Regards,

Yoann

Have not checked, but try "sourceTimestamp": new Date(168899760000),

I expect those field require DateTime not ms.

Hello,
Following up on this issue, I have deployed an OPC UA server using the OPC UA server node, and injected values to certain nodes. Upon writing a value to a node in my OPC UA server, and assigning a source timestamp, there seems to be a possible bug. The source timestamp assigned is being written to the server timestamp instead. The value is written sucessfully to this node, but the source Timestamp is being written to the server timestamp. this is the current payload sent to the opc ua server:

msg.payload= {"namespace": 10,
"messageType": "Variable",
"variableName":""Objects"."DeviceSet"."AssemblySystem01"."Assets"."Tools"."Value"",
"variableValue": 47,
"sourceTimestamp": 1688997600000,
"quality": "Good"}
return msg;

Also below is the result when accessed with an OPC UA client:

Just fixed this one to v0.2.315

1 Like

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