Hi all,
I am struggling to figure out a solution to my problem and I've looked through the forum and googled in general but I can't find the exact thing I need.
I have a power meter which has an internal MQTT broker and I'd like to get the data somehow into InfluxDB. Unfortunately, the format that the power meter outputs is not easily digestible by Influx. This is what I get out of the power meter:
[1586229942, 4405.360, "W"]
I would normally configure telegraf to consume these messages but it's not a nice key:value format. I'd like to use node-red to convert these messages then spit them back out to MQTT for telegraf to consume (I realise I could probably go straight to influx with node-red but it's a learning experience)
I have an MQTT-in node and MQTT-out, but I don't know what function to put in the middle to turn the 'array' that I have now into an 'object' more like:
{"timestamp":1586245760,"value":676,"unit":"W"}
If I set the MQTT input to output 'a parsed JSON object' it parses it as an array in the debug window, but I don't know how to manipulate those array values.
Thanks in advance.