What is the best way to detect Node-RED starting, running so I can start a connection to OPC-UA I/O?
Thanks,
What is the best way to detect Node-RED starting, running so I can start a connection to OPC-UA I/O?
Thanks,
You can use an inject
node with the once option, which will send a single message after 0.1s (configurable).
Sure, Is it that simple?
I guess what I was asking is this the means for a "First Scan" ? Maybe this is it.
I got looking at "Function" and the On Start script. Not sure the purpose of this. The context isn't clear.
Thanks.
You can also use the "On Start" part in which you add this to send a message at startup:
node.send({ payload: "Started" });
No inject
node needed for this option.
As far as I know (and would ask to be corrected in case I'm wrong), there is a risk that the sender node sends the on-start message to a node which has not been initialized yet and cannot receive the message.
Since the node initialization sequence goes tab by tab, left to right, I would suggest to place the initiating node as the last-created node on the last (rightmost) tab, and use a link out to send the on-start message to its destination.
Or simply wait ten seconds or so after startup to send your message. That's how mine is setup and seems to be reliable.
node.send({ payload: "Started" });
This is what I was looking to do. Thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.