# How to run a flow, based on a status

**URL:** <https://discourse.nodered.org/t/how-to-run-a-flow-based-on-a-status/48488>\
**Category:** General\
**Created:** [16 July 2021 12:13 UTC](https://discourse.nodered.org/t/how-to-run-a-flow-based-on-a-status/48488 "2021-07-16T12:13:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpbillund](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tpbillund/32/37410_2.png) [@tpbillund](https://discourse.nodered.org/u/tpbillund)\
**Post date:** [16 July 2021 12:13 UTC](https://discourse.nodered.org/t/how-to-run-a-flow-based-on-a-status/48488/1 "2021-07-16T12:13:32Z")

</div>

Hi

I have a Maria DB that have an home alarm status (ZigBee)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/f/1f2a36bff00ac96f1bf2ce4d4d3b8ac0ef576683.png)  
Working fine..

Then I have a trigger flow, that send a Telegram message, if a window is opened:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8ef16585e087ce67e905a4f70b9f8631a3c5c8d2.png)  
It's also working fine...

Now I need it to work together... the last Switch must only work, is the status switch is "Armed".

Can someone help/guide me, about based on the status "Armed" then the trigger flow is activated.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [16 July 2021 13:06 UTC](https://discourse.nodered.org/t/how-to-run-a-flow-based-on-a-status/48488/2 "2021-07-16T13:06:44Z")

</div>

Use a Change node to set a context variable flow.alarmstatus using the output from mariadb.  
Use a Switch node in your flow that sends a Telegram to only pass messages if flow.alarmstatus is "armed"

Note, if these are actually different flows either use global.alarmstatus or Link nodes so that flow.alarmstatus is both set and used in the same flow

---

<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:** [30 July 2021 13:07 UTC](https://discourse.nodered.org/t/how-to-run-a-flow-based-on-a-status/48488/3 "2021-07-30T13:07:40Z")

</div>

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