seems like mqtt2influx does not support any kind of external timestamp. Even if it did, you would need to assign each sample different timestamp. This seems like you would need to code your own script.
You can also use node-red and use function node to juggle with bytes and use InfluxDB plugin to write data.
Will the samples be periodic, or do you need precise timestamp with each sample?
In our NB-IoT sensor CHESTER we send with packet this information when we send aggergated data:
- unix timestamp of the first sample (uin32_t)
- period between samples (uint16_t in milliseconds)
- number of samples (uint16_t)
- buffer of float/uint16/32 values
This way we save some payload data, because the sampling is periodic and we can calculate timestamp of other samples.
All this information I would convert to array of bytes and send over radion in a single packet:
bool bc_radio_pub_buffer (void *buffer, size_t length)
Then in python/node-red you do the opposite and reconstruct timestamps and create a object with timestamps which you can simply pass to InfluxDB node that will write values with correct timestamps.
On server we unpack the data and put them back in nice JSON array:
We can help you with the format if you tell more info:
- what values do you sample (temperature?)
- how precise you like values to be? (0.1°C? or 0.5°C?)
- what is a sampling period?
- what is a transmission period?