I run into an issue where I would like to provide local timestamps of the measurement time (just the POSIX timestamp - 32 bit long value) together with measured values (mainly for generic MQTT) and I wonder which way would be the best? I can implement it and create a push request if neccessary. I know of mqtt restamping tools, e.g. mqtt-timestamper, but they would provide server-side timestamps.
The possibilities I have thought of for now:
- Provide a plugin with timestamp value (actually just calling now()) if time feature is enabled. Otherwise we could have either -1 like for VCC?
- This can be done by modifying the system info (026) plugin, which is the way I have originally done it. But to provide correct values, the plugin must return long values instead of floats, which may either break the formula calculations (division by float number) or the formulas would have to be disabled for this plugin and somebody may be using them. All other values returned from this plugin (RSSI, uptime, VCC, RAM) are integers anyway right now).
- Write a separate plugin (really small code, but would take 1 plugin ID)
- Add a timestamp to the MQTT message (but we may not set a template for value part if I am right)? Possibly as a checkbox in Advanced configuration. But there are several implementations of MQTT protocol right now and none is really the "generic one".