Mqtt Multiple Inputs to one Json Object or Array

Hi,

i have a OpenDTU Mqtt Input with Multiple Numbers in the msg.payload but no exact Identity. The Identity of each payload is in the Topic.

I want to add all togehter in a function and add the Identity to it like Voltage, Current etc.

How to do this ?

The normal Node-red way would be to use a Join node in manual mode, using msg.topic to distinguish each input.

For example, if you have messages with msg.topic == "current" and "voltage", you can set the join node to join after 2 message parts.

Why do you want to do it in a function?
Are you just reaching for a function node because you think it's needed, or is there some other reason?

See also this article in the cookbook for an example of how to join messages into one object.

1 Like

Thanks thats it :grinning_face: