Page 1 of 1

Node-RED combining value and unit in one object

Posted: Wed Jun 24, 2020 4:25 pm
by aleksandar.postolov
Hi everyone

I am playing with node-red in 3.17 and it's pretty cool so far. I am struggeling though, with combining the differend payloads from dpGet and dpGetUnit.

What I am trying to do is displaying a chart with the given unit from the datapoint. I do get the value and the unit from the datapoint, but I can't combine/join them, to display in the same chart.

Anyone an idea or expirience with node-red?

Best regards
Aleks

Re: Node-RED combining value and unit in one object

Posted: Mon Aug 10, 2020 10:01 pm
by c.fraenzer
Use a function block and pass both objects to it.

Then access the objects in the function as following

Code: Select all


var msg1 = {payload: msg.payload[1]};
var msg2 = {payload: msg.payload[2]};

var ret = msg1 + " " + msg2;

return ret;

if you look at the message object in the Debug window you can choose the right path to the object and paste it in the brakets.

If you have more questions regarding node Red just say so


Greetings