E.day
E.day

Reputation: 117

Node Red how to set property msg.complete

I have a template node witch is a timer schedule produce this message

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

I want to set many timers and send them in one message, for that I have added join function node witch has many option to create final message

After a number of message parts

After a timeout following the first message

After a message with the msg.complete property set

to add more flexibility I have to use the third option, so I need to know how to set msg.complete in template code enter image description here

Upvotes: 1

Views: 6607

Answers (2)

E.day
E.day

Reputation: 117

As @knolleary suggests I have added flag last:(yes/no) to message to check if it is the last msg or not

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

then pass the message to switch node if it isn't last message then pass it directly to join node

else it is the last one then pass it to change node to set msg.complete then pass msg to join node enter image description here

Upvotes: 2

knolleary
knolleary

Reputation: 10117

The ui_template node can only set the msg.payload property of the message it sends.

To set other properties, you'll need to add a Change node after the ui_template node.

If you want only certain messages from the ui_template node to have msg.complete set, then you'll need to add a flag in the msg.payload sent by the ui_template node which can checked for using a Function node to see if it should set msg.complete or not.

Upvotes: 2

Related Questions