Trigger Email if Input not recevied since x minutes?

Hi,

I am not great at javascript programming so apologies.

I have a battery operated weather station that I want to know when the batteries have died so I can replace them.

The weather station is sending data to my MQTT server every 20 minutes and into Node-Red.

I am trying to think of some way of writing a function that will send me an email if a "message" hasn't been received in the last 20 minutes.

Can anyone share how they would approach this please?

Trev

Hi @trevorjdaniel

Take a look at the Trigger node. It can be used to send a message if it doesn't receive one within a configurable time interval - exactly what you want.

Configure the node to send nothing when a message is received, then wait for 25 minutes (or how ever long a grace period you want to allow) and send (whatever payload you want).

The key part is to tick the box extend delay if new message arrives.

Nick

1 Like

Perfect!

Many thanks!!!

Trev

Extended question : how to send a second mail if data is received again ? :blush:

You need to explain your use case (and also probably open a new request)

Nick is pretty busy now days - so better off opening this to wider audience

Craig

Or maybe look at the problem differently. Rather than send nothing on first message send the “It’s working” messages. Then extend. Then send “it’s failed”. After the correct timeout. Tat way as soon as it starts again it will send working.

1 Like

Thank you @dceejay I'll investigate in that direction it looks clever :blush:

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