How do I combine 2 payload.status together?

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 combine2
NR combine3

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

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 ?

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
NR combine2

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
NR combine2
NR combine3

You can use   as the joining characters, So if you joined with     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.

[{"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}}       {{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":"   ","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  ","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}]

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

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