Switch on/off a flow for "alarm"

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:

ANY help will be really appreciated!

This recipe in the cookbook should help
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

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?

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

2 Likes