I am using Node-RED to get values from a Modbus device and store them in a database.
The frequency of the Modbus reading varies but may be as high as 100 ms.
Every row of the database requires two fields, the value and the timestamp of the acquisition time.
I am struggling with the latter. I do not know how to get the current timestamp at the time the Modbus value is obtained.
I have considered using the Inject node at the maximum frequency and drop the messages that do not correspond to the time a value is read. However, the Inject node does not handle frequencies in milliseconds.
I have seen that the trigger node does provide timestamp values in milliseconds frequencies but I do not know how to trigger it once every time I read a value. I could trigger it with the first reading and configure it to send a timestamp every few milliseconds but then it would not be stopped when Modbus readings are over.