Your version won't work because output
is an array of objects (so you are trying to convert an object to a number)
Did you try @E1cid solution? As far as I can see, it should just work.
Your version won't work because output
is an array of objects (so you are trying to convert an object to a number)
Did you try @E1cid solution? As far as I can see, it should just work.
Hi Steve,
Replaced:
var output = msg.payload.split(",").slice(1,4).map(e => {
return {payload:parseFloat(e)}
});
for
msg = msg.payload.split(":").slice(1,4).map(e => {
return {payload:parseFloat(e)}
});
var t1 = parseInt(output[0]);
var t2 = parseInt(output[1]);
var p = parseFloat(output[2]);
var msg0 = {payload:t1};
var msg1 = {payload:t2};
var msg2 = {payload:p};
return [msg0 , msg1 , msg2];
Now I have:
Rob, just try the function EXACTLY as @E1cid wrote it...
msg = msg.payload.split(":").slice(1,4).map(e => {
return {payload:parseFloat(e)}
});
return msg;
Ah, yes! Thanks. Now it is working.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.