在 Node-Red 中指定函数节点上的输出

Specify the output on a function node in Node-Red

我想知道如何指定函数节点可以return 消息 (msg) 的输出。

例如:

if( msg.eui == "00:11:22:33:44:55:66:88"){
    output1(msg); //return on the output 1 only
}
if( msg.eui == "00:11:22:33:44:55:66:99"){
    output2(msg); //return on the output 2 only
}

需要更改什么?

这是可以做到的。 Node-Red 使用 array of messages to address the different output ports

if( msg.eui == "00:11:22:33:44:55:66:88"){
    return [msg, null]; //return on the output 1 only
}
if( msg.eui == "00:11:22:33:44:55:66:99"){
    return [null, msg]; //return on the output 2 only
}

不应接收消息的输出设置为空,其他设置为return消息。