Hi, I am trying to convert the MQTT msg below into separate records for the ingest InfluxDB node:
{"device_id":"VEHIGE9820","sr":32,"device_t":1680654643559,
"x":[324,294,358,230,279,332,385,490,381,362,290,336,328,275,370,411,543,385,306,234,475,426,396,298,264,211,309,298,400,362,306,283],
"y":[155,143,181,324,234,166,260,362,207,204,302,223,226,207,234,136,358,396,298,306,260,321,226,181,449,290,109,256,91,339,219,181],
"z":[2150,2071,2184,2041,2018,2007,2033,2139,2082,2029,2003,2093,2154,1901,2018,2010,2056,2188,2161,2041,2124,2044,2135,2105,2108,2097,1897,2297,2033,1942,2154,2071]}
This sensor data arrives every second from an accelerometer that buffers 32 samples per second for all 3 axis (x
, y
and z
). It registers the timestamp device_t
when it grabs the last of those samples, then sends the mqtt msg.
In order to plot these msgs out in grafana, I need to have individual records of each 1/32s containing 3 axis values.
Therefore I need 32 records written to the influxdb node each sec, eg (device_id
, x1
, y1
, z1
, time1
), (device_id
, x2
, y2
, z2
, time2
)...(device_id
, x32
, y32
, z32
, time32
), etc, where time1
is the device time second (device_t
) / 32.
I hope this makes sense so far!. I am having issues creating a node that can split the msg into these individual msgs with their corresponding times... Any help or pointers would really help me out! thanks.