# Trigger Email if Input not recevied since x minutes?

**URL:** <https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909>\
**Category:** General\
**Created:** [6 September 2018 13:01 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909 "2018-09-06T13:01:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevorjdaniel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trevorjdaniel/32/7649_2.png) [@trevorjdaniel](https://discourse.nodered.org/u/trevorjdaniel)\
**Post date:** [6 September 2018 13:01 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/1 "2018-09-06T13:01:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [6 September 2018 13:08 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/2 "2018-09-06T13:08:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![trevorjdaniel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trevorjdaniel/32/7649_2.png) [@trevorjdaniel](https://discourse.nodered.org/u/trevorjdaniel)\
**Post date:** [6 September 2018 13:21 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/3 "2018-09-06T13:21:01Z")

</div>

Perfect!

Many thanks!!!

Trev

---

<div class="post-metadata">

**Author:** ![pagaille](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pagaille/32/18808_2.png) [@pagaille](https://discourse.nodered.org/u/pagaille)\
**Post date:** [6 April 2021 07:42 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/4 "2021-04-06T07:42:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [7 April 2021 15:43 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/5 "2021-04-07T15:43:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 April 2021 22:25 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/6 "2021-04-07T22:25:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pagaille](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/pagaille/32/18808_2.png) [@pagaille](https://discourse.nodered.org/u/pagaille)\
**Post date:** [29 April 2021 18:37 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/7 "2021-04-29T18:37:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 June 2021 18:37 UTC](https://discourse.nodered.org/t/trigger-email-if-input-not-recevied-since-x-minutes/2909/8 "2021-06-28T18:37:38Z")

</div>

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