Need to trigger an event at 00:00,00:05... (sync with clock)

My project requires to trigger an event at every 5 mins which has to be exact with the clock. i.e. at 00:00, 00:05, 00:10, ...
I can trigger an event at every 5 mins using a time node. The problem is that I can not sync this trigger with clock.
Is there any node which can do that?
Or is there any function call?
Worst case, I need to keep polling the time, and check the minute. If the minute reaches 00, 05, 10, 15..., I trigger the event. But it seems not the right way to do.
Thx

haven't used it myself, but I would look for a cron node, like https://flows.nodered.org/node/node-red-contrib-cron-plus

the core inject node will do this when set to "interval between times" mode. (It uses cron under the covers so every 5 minutes will be at 00, 05, 10, etc

1 Like

much better solution!

Hi,

Thanks for your reply, but I don't really understand. Do you mean I make 12x24 number of nodes? e.g. 12:00, 12:05, 12:10... The project will be big... but if it works, that's fine.
When I select "interval between times", I can't control when it starts.
Thx

I just downloaded the node. I can't click the schedule... not sure if I did anything wrong, or the node has problem. I wonder if anyone has used it before? Thx

I think Dave meant something like that

1 Like

Oh yes, it is working. :>
Thanks @dceejay and @cinhcet

Hi I understand you have a solution but I am concerned there might be an issue with cron-plus node (I an the developer of that node)

Are you saying when you click the add button underneath the schedules list that it doesn't create an entry in the schedules box?

I would be very grateful if you could screenshot any errors in the Devtools console immediately after opening the node and clicking add (press F12 to open Devtools then select the console tab)

Thanks.

For the cron-plus node, the add button is grey-out. I can't click anything nor type anything. I am using win 10 and Chrome

Hey @AK51, thanks for getting back to me.

Me too.

That's the default look of these small buttons. Did you try it?

Would you be kind enough to do the following...

  1. Open the cron node settings
  2. Click the add button once.
  3. Press F12 (Devtools will open)
  4. In Devtools, switch to the console tab
  5. Grab a screenshot of console and post it in a reply.

Cheers.

Ps, what node and node-red versions are you on?

Hi,
I reinstalled your node just now. I just added the node without touching any setting and without connecting any wire, but it crashed my program. The original timestamp of sending 1 sec data has problem. Not sure what happened.
After deleting the node, the project runs fine.
I had a quick check and the 'add' button can be clicked.

Thank for feedback.
Quite unfortunate Indeed.

Did you capture the log? Would be very useful in resolving this.

I'd be very grateful if you could help me pin this down.

What nodejs version are you using? What version of node-red? What OS (windows? Linux? Raspian? Etc)

But mostly the log would be very helpful.

Thanks.