I'm not seeing the elephant - code help

Given the message structure is correct:

I am not understanding why I am not seeing the correct output.

//  msg.existing is the EXISTING value for the LEDs
//  Split the payload.
const check = msg.payload.split(",");

node.warn("Wipe " + msg.wipe);

let msg1 = {};

let led = check[1];
if (led != 0)
{
    node.warn("LED " + led);
    //node.warn(msg.existing);
    let value = msg.existing[led];
    node.warn("Value " + value);
    let x = led + ',' + value;
    node.warn("x is " + x);
    msg1 = {"payload":"rgb," + led + ',' + value};
    node.warn("msg1 " + msg1);
}

if (msg.wipe == "OLD")
{
    return [msg.msg1];
}
else
return [msg,null];

I have a fear I am going to kick myself.

But I'm not too proud to admit I am not seeing the cause.

FOUND IT!

return [msg.msg1]
and not
return [msg,msg1]

SORRY!

Isn't it the other way around?

return [msg,msg1]
and not
return [msg.msg1]

Well, I was saying it in the context of what I had and what I should have put.

So I said I had (originally) return [msg.msg1] rather than return msg, msg1]

AND! I found it all by myself - which is kind of good.

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