How to do something if a specific condition persist for a specific time

I’m monitoring a Innr plug where is plugged my fridge.
At the moment my flow just insert the current consumption in an influxdb table and then I use ti with Grafana to monitor the fridge consumption.
Now I would like to add a piece of code to check if there is a consuption below a specific threshold for a specific time to raise an alert Because the fridge could be broken.
Is there any smart way to do this (new palette to add…) ?

Thank You

You could use a Stop timer. When the state of your sensor falls below X, the Stop timer begins counting for the specific amount of time. When the time expires, you get a notification. If during that time the state of the sensor returns to an acceptable position, deliver a STOP message to the timer and the timer will stop, and then you can add any notification or action to that path.

1 Like

A trigger node will do it, no need to add any extra node types. Configure it to wait the desired time before passing the message along, and reset it if the consumption gets above threshold again.

Like this


1 Like

Thank You guys,
both solution work fine.
The @arretx one is easier to be understood immediately and the @AndreasM one is completely already integrated and let me learn more about Node-Red messages.

Thank You again

the wait until node is a really simple way to do this as well.

wait for a set amount of time until the state meets your condition,

  • if it does one output is chosen
  • if it doesn’t and the time runs out another output is chosen

I use them all the time for things like, waiting for a set amount of no movement before turning of the lights etc.