# Send Email Alarm only once

**URL:** https://discourse.nodered.org/t/send-email-alarm-only-once/43184
**Category:** General
**Created:** [25 March 2021 09:25 UTC](https://discourse.nodered.org/t/send-email-alarm-only-once/43184 "2021-03-25T09:25:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![monokumamon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/monokumamon/32/39262_2.png) [@monokumamon](https://discourse.nodered.org/u/monokumamon)
#### Post date: [25 March 2021 09:25 UTC](https://discourse.nodered.org/t/send-email-alarm-only-once/43184/1 "2021-03-25T09:25:37Z")

</div>

Hello, im new to Node-RED. I'm using a vibration sensor and I manage to send an email when the alarm triggered. The problem I'm having right now is, I want Node-RED only send the alarm once not multiple times when the alarm triggered. Is there a way to do this?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [25 March 2021 09:53 UTC](https://discourse.nodered.org/t/send-email-alarm-only-once/43184/2 "2021-03-25T09:53:32Z")

</div>

> [@monokumamon](#):
>
> Is there a way to do this?

Sure, create a flow variable that will act as a switch. before you send the message, check if a msg has been sent (`switch` node) and after the email node, set the variable to indicate the message has been sent (`change` node).

Of course now you have to think about how you will reset the switch...after 5 hours, 10 minutes? I'd add a `delay` and another `change` node - after the first `change` node - to reset the switch

---

<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: [8 April 2021 09:53 UTC](https://discourse.nodered.org/t/send-email-alarm-only-once/43184/3 "2021-04-08T09:53:39Z")

</div>

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