# Turn off switch only if triggered by same flow

**URL:** <https://discourse.nodered.org/t/turn-off-switch-only-if-triggered-by-same-flow/84529>\
**Category:** General\
**Created:** [14 January 2024 09:48 UTC](https://discourse.nodered.org/t/turn-off-switch-only-if-triggered-by-same-flow/84529 "2024-01-14T09:48:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smitterer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/smitterer/32/59179_2.png) [@smitterer](https://discourse.nodered.org/u/smitterer)\
**Post date:** [14 January 2024 09:48 UTC](https://discourse.nodered.org/t/turn-off-switch-only-if-triggered-by-same-flow/84529/1 "2024-01-14T09:48:54Z")

</div>

Hi everyone,

I have the following flow which turns on and off pumps of a hot tub to protect it from freezing.

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

The circulation pump should only be turned off if it wasn't turned on from a different flow which triggers the pump for filtering.

Does anyone have an idea how I could do that?

Thanks

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [14 January 2024 10:15 UTC](https://discourse.nodered.org/t/turn-off-switch-only-if-triggered-by-same-flow/84529/2 "2024-01-14T10:15:13Z")

</div>

Hi,  
When you trigger your filtration pump, add a `change` node to save the state of the pump in a global variable. With this way you can check if it isn't working and turn off your circulation pump. Between your `Turn Off` node and `Pump Circulation` add a `switch` node which checks if your global variable is off, which transmits the message to turn off the circ pump.

---

<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:** [14 March 2024 10:16 UTC](https://discourse.nodered.org/t/turn-off-switch-only-if-triggered-by-same-flow/84529/3 "2024-03-14T10:16:00Z")

</div>

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