MODBUS timestamp

I am in need of some assistance with a project I'm currently working on. I need to monitor an energy meter through MODBUS, and while all the energy measurements are assigned to registers, there is no timestamp included.

To capture the timestamp of the measurement, the closest we can get is by using the time of the request with an inject node and passing it in the flow as the timestamp of the measured values. However, the issue I'm encountering is that the output of the MODBUS node is fixed to only pass the register values, resulting in the timestamp being lost.

Here is a summary of what I'm trying to achieve:

  1. Use an inject node to initiate the request and capture the current timestamp.
  2. Pass this timestamp through the flow.
  3. Ensure the MODBUS node output includes the timestamp along with the register values.

Has anyone faced a similar issue or has any suggestions on how to achieve this? Any advice or examples would be greatly appreciated.

Thank you in advance for your help!

Save the timestamp in a flow variable? Storing Data in Node-Red Variables

Then route the output of the MODBUS node to a calculation where you add it back in without changing anything of the message.

If the modbus node does not pass a timestamp through in a msg property that is not payload, then you should raise this issue with the node maintainer, as well behaved nodes should pass msg properties on.

As work around you have three methods

I would add the timestamp after the modbus node. You can do that by passing it through a Change node configured to set msg.timestamp to the current time. Or if the payload is an object then set msg.payload.timestamp to the time.

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