# How to enable and disable the notification node using a button from the dashboard

**URL:** <https://discourse.nodered.org/t/how-to-enable-and-disable-the-notification-node-using-a-button-from-the-dashboard/26088>\
**Category:** General\
**Created:** [4 May 2020 20:37 UTC](https://discourse.nodered.org/t/how-to-enable-and-disable-the-notification-node-using-a-button-from-the-dashboard/26088 "2020-05-04T20:37:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joaovitor](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Joaovitor](https://discourse.nodered.org/u/Joaovitor)\
**Post date:** [4 May 2020 20:37 UTC](https://discourse.nodered.org/t/how-to-enable-and-disable-the-notification-node-using-a-button-from-the-dashboard/26088/1 "2020-05-04T20:37:13Z")

</div>

Hello everyone. I am developing an application through node red whose main objective is to read the information of sensors through the mqtt protocol.

But anyway, I'll get straight to the point: I intend to implement a notification system in my app. In a way, if a given sensor's data exceeds the maximum allowed value, the notification is activated. So far so good. through a function node I was able to implement the logic through an if and a comparison. I only compare the msg.payload with a value and if the condition is met the msg.payload is returned until notification.

Here's my problem: I wanted to implement a button on the dashboard to activate notifications if necessary, a kind of "don't be disturbed".

In what ways could you do this?

I have already tried to insert in the if within a function node the value of the button and the maximum value of the sensor. if both conditions were true the notification shown on the screen. but it didn't work.

If anyone has another solution to my problem through dashboar, I would be grateful if I checked.

Thank you.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [4 May 2020 20:46 UTC](https://discourse.nodered.org/t/how-to-enable-and-disable-the-notification-node-using-a-button-from-the-dashboard/26088/2 "2020-05-04T20:46:34Z")

</div>

Have the button toggle flow or global context variable.

Then use a switch or function to check the flow/global value state. If its "off", stop the flow & so forth.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [4 May 2020 21:19 UTC](https://discourse.nodered.org/t/how-to-enable-and-disable-the-notification-node-using-a-button-from-the-dashboard/26088/3 "2020-05-04T21:19:16Z")

</div>

You could take a look at [node-red-contrib-simple-gate](https://flows.nodered.org/node/node-red-contrib-simple-gate).

---

<div class="post-metadata">

**Author:** ![Joaovitor](https://avatars.discourse-cdn.com/v4/letter/j/3ab097/32.png) [@Joaovitor](https://discourse.nodered.org/u/Joaovitor)\
**Post date:** [4 May 2020 22:00 UTC](https://discourse.nodered.org/t/how-to-enable-and-disable-the-notification-node-using-a-button-from-the-dashboard/26088/4 "2020-05-04T22:00:35Z")

</div>

I installed the gate node and connected the button to it, as well as the mqttin (input of sensor data). I programmed the button with the open and close states.

It is working as desired. information is only sent for notifications only when the button is activated (open).

It was the most simple and functional way I found.

Thanks a lot for the help.

---

<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:** [18 May 2020 22:00 UTC](https://discourse.nodered.org/t/how-to-enable-and-disable-the-notification-node-using-a-button-from-the-dashboard/26088/5 "2020-05-18T22:00:36Z")

</div>

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