Timers and Timed Actions

I am currently using node-red-contrib-cip-ethernet-ip and node-red-node-mysql to read tags off a PLC, and push them into a MySQL database for use in another application. What I want to do, is read off the tags at a timed interval (i.e 1 sec), and push these into the database.

I have this roughly implemented, it all works how I want it.. However it also pushes data whenever a value im monitoring changes.

As an example.. Tag 1 and 2 change.. I end up getting 3 logs in my database, 1 where tag 1 changes, 1 where tag 2 changes, and a final one from my 1 second resend.

Is there a way to ensure the changing of tags isn't pushing information into my formula and therefore my SQL, and it only happens every 1 second?

As a note, I have tried using a filter node, but it just cuts it down to 2 sends, instead of just a singular 1 every second like I want.

Split your flow into 2 parts....

  1. Store the values coming from EIP in context using change nodes.
  2. On your predefined interval, grab the stored values out of context and send them to database.
1 Like