Combine multiple mqtt messages into one measurement for influx

As a beginner with node-red I don't know where to start so some help would be very appreciated.

I have many sensors reporting themselves by publishing to mqtt topics. They send the following data:
10_52_1C_66_1D_CC/dsmr/smart_gateways/model = esp-dsmr-4
10_52_1C_66_1D_CC/dsmr/smart_gateways/mac_address = 10_52_1C_66_1D_CC
10_52_1C_66_1D_CC/dsmr/smart_gateways/startup_time = 2021-04-12T12:40:14Z
10_52_1C_66_1D_CC/dsmr/smart_gateways/running_firmware_version = 2021041002
10_52_1C_66_1D_CC/dsmr/smart_gateways/update_available = 2021041002
10_52_1C_66_1D_CC/dsmr/smart_gateways/wifi_rssi = -63
10_52_1C_66_1D_CC/dsmr/smart_gateways/use_blynk = true

Each sensor is publishing it's mac address as the topic prefix.

I want to combine all these different topics into one json message and write it as seperate measurements in influx.

The above topics arrive in sequence every 5 minutes from every sensor. I see this in the debug:

A simple example of how to split the topic and use one element as topic for join node
e.g

[{"id":"4f15f387.24ecc4","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"23:23/eee/eeee/wifi","payload":"231.6","payloadType":"str","x":170,"y":3620,"wires":[["1c88b7e4.483858"]]},{"id":"1c88b7e4.483858","type":"function","z":"5a245aa1.510164","name":"","func":"msg.topic = msg.topic.split(\"/\")[3];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":240,"y":3640,"wires":[["2af57594.1a21d2"]]},{"id":"7283ee1e.d0796","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"23:56/ff/ffff/rssi","payload":"QTot: 0 ","payloadType":"str","x":150,"y":3680,"wires":[["1c88b7e4.483858"]]},{"id":"2af57594.1a21d2","type":"join","z":"5a245aa1.510164","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":390,"y":3640,"wires":[["759a8f1c.44e9b"]]},{"id":"759a8f1c.44e9b","type":"debug","z":"5a245aa1.510164","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":610,"y":3640,"wires":[]}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.