Combine more than one msg.payload in one msg.payload

Hello I'm student and I'm doing my final year project I need your help to combine three msg.payload to one msg.payload to send it
{
temperature: msg.payload 2 °C
humidity: msg.payload 1 °C
weatherState: msg.payload 3 °C
}
as it is shows on the figure below.
how do I define each .msg.payload on function

Thanks
.node-red

You can join using a join node.
eg.

[{"id":"1a5a5100.cba56f","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"temp","payload":"24","payloadType":"num","x":140,"y":3340,"wires":[["aa267a23.3a256"]]},{"id":"aa267a23.3a256","type":"join","z":"8d22ae29.7df6d","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":310,"y":3360,"wires":[["ab78e316.4e418"]]},{"id":"ab78e316.4e418","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":510,"y":3360,"wires":[]},{"id":"d456da5.d232c28","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"humid","payload":"54","payloadType":"num","x":130,"y":3380,"wires":[["aa267a23.3a256"]]},{"id":"6d0f0e71.4d16c","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"state","payload":"2","payloadType":"num","x":120,"y":3440,"wires":[["aa267a23.3a256"]]},{"id":"9c44d3a7.248b18","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload.state","v":"2","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":3260,"wires":[["d2d96acf.309768"]]},{"id":"35784423.553f3c","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload.humd","v":"54","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":3220,"wires":[["d2d96acf.309768"]]},{"id":"f0da1e81.6fa448","type":"inject","z":"8d22ae29.7df6d","name":"","props":[{"p":"payload.temp","v":"24","vt":"num"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":3180,"wires":[["d2d96acf.309768"]]},{"id":"d2d96acf.309768","type":"join","z":"8d22ae29.7df6d","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":300,"y":3200,"wires":[["610165dc.55217c"]]},{"id":"610165dc.55217c","type":"debug","z":"8d22ae29.7df6d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":500,"y":3200,"wires":[]}]

i have shown two examples

Thank you so much I did it. :slight_smile: @E1cid

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