Count number of messages in the last 10 minutes

Hi,
i'm stuck with following problem.
I get incoming messages of a a "tcp in" node from a keyence vision system if this system detects an error.
And i want to send a message via telegram if there are 6 errors in the last 10 minutes.

My idea is to create an array 0-9. Now i count the incoming errors every minute to array[0]. Also i shift the array every minute so array[8] goes to array[9] and array[7] goes to array[8] ... and array[0] is set to 0.

Is this the right direction or is there an easier way?

EDIT: I just found this node which is eventually suitable: node-red-contrib-msg-speed (node) - Node-RED (nodered.org)

So i change my question: Is my idea a good way if i want to solve my problem with the function node?

Can that be turned round the other way and instead send the message after 10 minutes if there is not a good signal in that interval? That would be much easier to implement, using just a Trigger node.

Unfortunately not, because sometimes the mashine is turned off or paused.

But i use this method already for a different solution. Basically it works like a watchdog.

Is there no way of knowing that the machine is turned off or paused?

If not then you will have to implement something along the lines you have suggested.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.