# Switch on/off a flow for "alarm"

**URL:** <https://discourse.nodered.org/t/switch-on-off-a-flow-for-alarm/11038>\
**Category:** Dashboard\
**Created:** [12 May 2019 12:47 UTC](https://discourse.nodered.org/t/switch-on-off-a-flow-for-alarm/11038 "2019-05-12T12:47:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eaventer](https://avatars.discourse-cdn.com/v4/letter/e/74df32/32.png) [@eaventer](https://discourse.nodered.org/u/eaventer)\
**Post date:** [12 May 2019 12:47 UTC](https://discourse.nodered.org/t/switch-on-off-a-flow-for-alarm/11038/1 "2019-05-12T12:47:36Z")

</div>

Hi All

I am very new and so out of depth its not even funny, but I have been playing around with tasmota/Mqtt and node red for going on to 6 months now and it is hectic! In this almost 6 months I have I have several switches on my dash board and a temp and humidity guage which I am extremely happy with. Then of course I started playing around wit sensors (sonoff's door/window sensors and motion detectors) I know sonoff's sensors is not the best as they only send one "code" to let the RF bridge know that there is movement but for now it is a start for me. So I got these in a flow and it is relatively easy to get to do things for example switch on a light and turn off again after x amount of minutes. BUT after a week now and trying to read and understand what is happening in the forum I cannot place a switch to stop and to start this flow. All I want is on the dashboard to display a switch whereby I can switch on that if a topic arrives from the sensors to what ever I want them to do and if I wish to stop it from " listening" to that topic!

My flow looks like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/baaccff96d3bb187aaa1bebb94fd710c8e63863b.png)

ANY help will be really appreciated!

---

<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:** [12 May 2019 14:13 UTC](https://discourse.nodered.org/t/switch-on-off-a-flow-for-alarm/11038/2 "2019-05-12T14:13:56Z")

</div>

This recipe in the cookbook should help  
[https://cookbook.nodered.org/basic/route-on-context](https://cookbook.nodered.org/basic/route-on-context)  
Use your ui-switch to set the state of the flow variable  
Use the switch node in the recipe to route the flow onward when on and to an unwired output when off

---

<div class="post-metadata">

**Author:** ![eaventer](https://avatars.discourse-cdn.com/v4/letter/e/74df32/32.png) [@eaventer](https://discourse.nodered.org/u/eaventer)\
**Post date:** [12 May 2019 20:29 UTC](https://discourse.nodered.org/t/switch-on-off-a-flow-for-alarm/11038/3 "2019-05-12T20:29:18Z")

</div>

Thank you for time answering this, but this is well BEYOND my head I have spend the past couple of hours on this and the only thing I have to show is, the following realization: I Really thought I could "wing" this but ALAS I will need to start from scratch and learn the basics. Any pointers to get a proper foundation in the node red world? where to start as I have zero and I mean ZERO experience! I only got this far by copying and pasting and of course You Tube! the reason why I ask is with You Tube one can get side tracked VERY quickly! What would you suggest sir my mind tells me JavaScript first then something in node red?

---

<div class="post-metadata">

**Author:** ![rgerrans](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@rgerrans](https://discourse.nodered.org/u/rgerrans)\
**Post date:** [13 May 2019 13:06 UTC](https://discourse.nodered.org/t/switch-on-off-a-flow-for-alarm/11038/4 "2019-05-13T13:06:00Z")

</div>

> [@eaventer](#):
>
> Any pointers to get a proper foundation in the node red world?

Along with the standard Node-Red docs, I found this site to be super helpful when I first started [http://noderedguide.com](http://noderedguide.com)
