# How do I combine 2 payload.status together?

**URL:** <https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499>\
**Category:** Dashboard\
**Created:** [12 November 2022 17:58 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499 "2022-11-12T17:58:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikee1234K](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikee1234k/32/70283_2.png) [@Mikee1234K](https://discourse.nodered.org/u/Mikee1234K)\
**Post date:** [12 November 2022 17:58 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/1 "2022-11-12T17:58:39Z")

</div>

I have a temperature sensor which reports temperature and humidity. This is in 2 seperate devices.  
Temperature reports '20 C' in status  
Humidity reports '78%' in status  
I want to end up with a payload which has both values (as string) so in this example '20 C 78%'

I tried adding in a change node but that shows one after the other, it wont add the strings

 ![NR combine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0cb1c063f7ade0feb44db3590b8df01e99345da0.png)  
 ![NR combine2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/c/4c32a40acd4dda4e128731ee202724c6f1f6b3e2.png)  
 ![NR combine3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/9/d938a1d41899f6fd4f779046d024bef3f1df9fec.png)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [12 November 2022 18:28 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/2 "2022-11-12T18:28:08Z")

</div>

Use a join node before the (last) change node, set it to manual a configure it to send the message after a count of 2

---

<div class="post-metadata">

**Author:** ![Mikee1234K](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikee1234k/32/70283_2.png) [@Mikee1234K](https://discourse.nodered.org/u/Mikee1234K)\
**Post date:** [12 November 2022 18:55 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/3 "2022-11-12T18:55:42Z")

</div>

That works. How can I set the 20 C to be first ? As it sometimes shows 74 % 20 C and other times 74% 20 C  
Set a delay node after the humidity node ?

---

<div class="post-metadata">

**Author:** ![Mikee1234K](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikee1234k/32/70283_2.png) [@Mikee1234K](https://discourse.nodered.org/u/Mikee1234K)\
**Post date:** [12 November 2022 19:02 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/4 "2022-11-12T19:02:46Z")

</div>

The delay seems to work to set the temperature first. I tried adding a space after the temperature, it has worked looking at the debug node, but the result is still only 1 space apart. Is there a way to add a extra  
space between temperature and humidity ?  
 ![NR combine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2fe1f2aec71aefef59b1e19ad8a69ddf075b5e7d.png)  
 ![NR combine2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/0/000b2b5d414bed21e5d121f2a41092e1cd2320a1.png)

---

<div class="post-metadata">

**Author:** ![Mikee1234K](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikee1234k/32/70283_2.png) [@Mikee1234K](https://discourse.nodered.org/u/Mikee1234K)\
**Post date:** [12 November 2022 19:39 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/5 "2022-11-12T19:39:01Z")

</div>

Not sure it is possible to add the extra space. What would work if I could keep the assigned colours for temperature and humidity in the join node. I have tried assigning different colours before the join node for temperature and humidity. But they seem to get lost  
The way I am trying to set them in the change node before the join, I set msg.color to lime for temp, in the other change node I set msg.color to cyan.  
But the result is always in cyan  
 ![NR combine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c3d6a1e75fa334a494e7a66913cdb19edf755950.png)  
 ![NR combine2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e3089d16e840a41979cff3c4199f8a10a13c7731.png)  
 ![NR combine3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/6979976385a9df37b6e965f0ce24f001a2fc4511.png)

 ![NR combine4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/4/f4e1e8ea3ba63a9ddd76d0ccc2141851d11db705.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [12 November 2022 20:09 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/6 "2022-11-12T20:09:02Z")

</div>

You can use `&nbsp;` as the joining characters, So if you joined with `&nbsp;&nbsp;&nbsp;` the gap between the values would be bigger.

BUT

It is best to join as object using msg.topic (or any you want to use) to set the property name. That way you know where each measurement is and you don't have to have any delays. You can the show the values in what ever order you wish.  
here are two example flows.

```auto
[{"id":"f555183fa1e7e306","type":"inject","z":"8030dcb2a33ca05b","name":"join as object using msg.topic","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":240,"wires":[["6d0863748f549787","20b4f9f4c4fcf380"]]},{"id":"6d0863748f549787","type":"change","z":"8030dcb2a33ca05b","name":"simulate temp input","rules":[{"t":"set","p":"payload","pt":"msg","to":"20 C","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"temp","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":200,"wires":[["9df4e6305ad9f706"]]},{"id":"20b4f9f4c4fcf380","type":"change","z":"8030dcb2a33ca05b","name":"simulate hum input","rules":[{"t":"set","p":"payload","pt":"msg","to":"70 %","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"hum","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":260,"wires":[["9df4e6305ad9f706"]]},{"id":"9df4e6305ad9f706","type":"join","z":"8030dcb2a33ca05b","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":650,"y":220,"wires":[["51d6dbdf3c4c6113","36cc490473c14f0b"]]},{"id":"51d6dbdf3c4c6113","type":"ui_text","z":"8030dcb2a33ca05b","group":"2d4fe667.28f8ba","order":18,"width":0,"height":0,"name":"","label":"text","format":"{{msg.payload.temp}}&nbsp;&nbsp;&nbsp;&nbsp; {{msg.payload.hum}}","layout":"row-spread","className":"","x":710,"y":280,"wires":[]},{"id":"36cc490473c14f0b","type":"debug","z":"8030dcb2a33ca05b","name":"debug 108","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":160,"wires":[]},{"id":"a7e6790d13278b43","type":"join","z":"8030dcb2a33ca05b","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"&nbsp;&nbsp;&nbsp;","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":630,"y":380,"wires":[["e6437819f5c3ddb6","51d6dbdf3c4c6113"]]},{"id":"2051b1585dfa3b92","type":"change","z":"8030dcb2a33ca05b","name":"simulate temp input","rules":[{"t":"set","p":"payload","pt":"msg","to":"20 C","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"temp","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":360,"wires":[["a7e6790d13278b43"]]},{"id":"c332582b21296b33","type":"delay","z":"8030dcb2a33ca05b","name":"","pauseType":"delay","timeout":"300","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":550,"y":420,"wires":[["a7e6790d13278b43"]]},{"id":"e6437819f5c3ddb6","type":"debug","z":"8030dcb2a33ca05b","name":"debug 109","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":460,"wires":[]},{"id":"1d12eabb77125725","type":"inject","z":"8030dcb2a33ca05b","name":"join as string with &nbsp;","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":380,"wires":[["2051b1585dfa3b92","c55eaf3b387e013c"]]},{"id":"c55eaf3b387e013c","type":"change","z":"8030dcb2a33ca05b","name":"simulate hum input","rules":[{"t":"set","p":"payload","pt":"msg","to":"70 %","tot":"str"},{"t":"set","p":"topic","pt":"msg","to":"hum","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":420,"wires":[["c332582b21296b33"]]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Mikee1234K](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mikee1234k/32/70283_2.png) [@Mikee1234K](https://discourse.nodered.org/u/Mikee1234K)\
**Post date:** [13 November 2022 19:10 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/7 "2022-11-13T19:10:17Z")

</div>

Thanks for that. That works well.  
Is theer a way to have 2 different colours for temperature and for humidity ? I have been experimenting, but so far I can only get them to display in one colour

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 December 2022 19:10 UTC](https://discourse.nodered.org/t/how-do-i-combine-2-payload-status-together/70499/8 "2022-12-13T19:10:25Z")

</div>

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