Though I am open to alternate nodes to do this.
(Actually I am now thinking this is not the right node for this job, but.....)
I have a message payload (example)
I want to split it into 3 messages:
I'm not up on node-red's asynchronous operations, but it may not be needed.
Oh, Specifications for the function:
3 digits. Numbers.
Must be 3 numbers long.
0 must be sent. (Kinda given if 3 digits)
A nominal delay between messages being sent out.
With function node maybe like this
let digits = msg.payload.toString().split('');
let realDigits = digits.map(Number)
And then add delay node after function node and adjust the delay between messages as needed.
I'm happy with that.
I was messing around with:
var y = 0;
var z = 0;
var x = msg.payload;
y = parseInt(x / 100);
msg.payload = y;
x = x - (y * 100);
msg.payload = x
msg.payload = "test";
test isn't needed, but just to see progress.
So I was:
int(/100) -- send result
int(/10) -- send result
send last digit.
But yours seems nicer.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.