节点红色怎么设置属性msg.complete

Node Red how to set property msg.complete

我有一个模板节点是一个定时器调度程序来生成这条消息

{"hour":5,"minute":5,"staus":false,"Tu":true,"We":false,"Sa":true}

我想设置多个计时器并在一条消息中发送它们,为此我添加了连接功能节点 有很多选项可以创建最终消息

After a number of message parts

After a timeout following the first message

After a message with the msg.complete property set

为了增加灵活性我必须使用第三个选项,所以我需要知道如何在模板代码中设置 msg.complete

ui_template节点只能设置其发送消息的msg.payload属性

要设置其他属性,您需要在 ui_template 节点之后添加一个 Change 节点。

如果您只希望来自 ui_template 节点的某些消息具有 msg.complete 设置,那么您需要在 ui_template 发送的 msg.payload 中添加一个标志=] 节点,它可以使用 Function 节点来检查它是否应该设置 msg.complete

正如@knolleary 建议的那样,我在消息中添加了标志 last:(yes/no) 以检查它是否是最后一条消息

{"hour":3,"minute":3,"staus":true,"Su":true,"Mo":true,"last":"no"}

然后将消息传递给 switch 节点如果它不是最后一条消息则直接将它传递给 join 节点

否则是最后一个然后传给change节点设置msg.complete然后传msg给join节点