How can i build a random delayed trigger loop?

Exactly! But for some reason @eugene objects to using an inject node and says it has caused problems in his flow:

I don't really see much of an issue here, but I thought I could help without much effort or added complexity in the code.

Ah well, up to you. Not sure what this obsession folk have with running with the editor open is about but hey :slight_smile:

Good point. You can't click what you can't see...

It's because it is so wonderful we need to use it every day. :wink:

1 Like

Hi, I found out that when I click inject button. Timer delay would of event generator would go crazy (reset even delay is not finish)
This is the reason, why I am looking for random generator that will run indefinitely, without inject button that could mess it up.

If the "reset" you describe is all that you mean by "go crazy," then that is the intended behavior. Switching the generator off stops it immediately so that no more events are emitted. This seems to be the sensible thing to do, as in "stop means stop." There may be confusion because the status text shows the time until the next event, which may never occur if the generator is switched off before it is due. I thought this extra information might be useful (output messages already have the msg.delay property that gives the time since the previous message), but you can disable the node status display for the flow, if you wish.

This is the problem:
Event Node did not run after restarting Node-Red.
But inject node run by itself. I hope I made you guys see the point.
image

I notice that the inject node control:timestamp does not have the circular arrow (which means it has a schedule set up) or a little number 1 (which means it runs once at startup/deploy) as is shown on the inject node feeding the random node. This tells me that it is setup ONLY to run when you click the button.

This is why the top two flows did not run when you restarted Node-RED while the bottom one did.

Sorry my bad. Yes. That was my mistake. I could let it start once.
But on the first two flow, accidentally clicking inject button would stop/toggle the delay making it breakable.
while the bottom flow, delay is unbreakable.

I apologized again. The crazy behavior happens when I edit logic to ignore toggle. That way, when initially accepted control, it would remain on. But after modifying code to ignore 2 input. Seems that delay messages displayed on node icon is not in sync with output.