【问题标题】:Specify the output on a function node in Node-Red在 Node-Red 中指定函数节点上的输出
【发布时间】:2017-02-09 11:09:49
【问题描述】:

我想知道如何指定函数节点可以在哪个输出上返回消息 (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
}

需要改变什么?

【问题讨论】:

    标签: ibm-cloud iot node-red


    【解决方案1】:

    这是可以做到的。 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
    }
    

    不应该接收消息的输出设置为null,另一个设置为返回消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-11
      相关资源
      最近更新 更多