Skip to main content

Example

There are 3 data sources connected to supOS, and we need to combine them together for the next step.

{
"workshop": {
"furnace1": {
"temp": 85
},
"furnace2": {
"humidity": 64
},
"furnace3": {
"pressure": 80
}
}
}

What Node to be Used?

In this example, we use join node to combine previous messages.

ParameterDescription
Mode

Join mode.
manual: You configure how to merge messages yourself.
auto: Automatically reassemble sequences split by a split node, based on msg.parts.
reduce sequence – Runs a JavaScript reduce function across the sequence to produce a single result.

Combine each

Message part you want to combine. Commonly msg.payload, but can be others (e.g. msg.data.value).

to create

Result type:
a merged Object: Merge all objects into a single object (later keys overwrite same-name keys).
a key/value Object: Use a key property (default msg.topic) as the key, and the Combine each property as the value.
an Array: Append each value to an array in order.
a String / a Buffer: Concatenate text or binary data (String can use a separator; Buffer is joined as binary).

Use existing msg.parts property

When selected, the node uses the msg.parts from previous nodes (usually created by a split node) to determine grouping and when to send the joined output. Fields like msg.parts.count and msg.parts.index are used.

Send the message → After a number of message parts

Outputs the joined result after receiving the set number of fields.

Send the message → and every subsequent message

When selected, after the initial output, the node outputs an updated result upon new messages arrival.

Send the message → After a timeout following the first message

Optional. Starts a timer when the first message arrives; once the timeout (seconds) is reached, the node outputs whatever has been collected.

Send the message → After a message with the msg.complete property set

Outputs the joined result immediately when a message arrives with msg.complete = true.

(Advanced) String/Buffer separator

For String output, an optional separator can be set. For Buffer output, data is concatenated directly with no separator.

How to Combine Sources?

  1. In EventFlow, drag in 3 mqtt in nodes, and subscribe to corresponding topics relatively.
  1. Connect a join node to all 3 nodes, and merge them into an object.
  1. Connect a debug node, and trigger the flow to check the results.