# Switch node-red losing data

**URL:** <https://discourse.nodered.org/t/switch-node-red-losing-data/38783>\
**Category:** General\
**Created:** [8 January 2021 11:32 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783 "2021-01-08T11:32:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![marconr9](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marconr9/32/34116_2.png) [@marconr9](https://discourse.nodered.org/u/marconr9)\
**Post date:** [8 January 2021 11:32 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/1 "2021-01-08T11:32:35Z")

</div>

I have a question.  
There is data coming from my Domoticz system.  
My flow is working every day with a timer.  
Not every day i have to need to run that flow.  
Now i wanted to make a switch between json node and the timer.  
If I place there a switch a lose my data,  
Please help,

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/6438e72d14ebbed74f031b2ffa8c9d2d050bf5a2.jpeg)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 January 2021 11:41 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/2 "2021-01-08T11:41:59Z")

</div>

what is the data coming to the `switch` node?  
What are the settings in your `switch` node?  
what do you expect the `switch` node to do?

---

<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:** [8 January 2021 11:43 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/3 "2021-01-08T11:43:26Z")

</div>

To add to what @zenofmud says, attach debug nodes to the output pin of EVERY node - you will be able see what is happening & understand why your switch is blocking.

---

<div class="post-metadata">

**Author:** ![marconr9](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marconr9/32/34116_2.png) [@marconr9](https://discourse.nodered.org/u/marconr9)\
**Post date:** [8 January 2021 12:00 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/4 "2021-01-08T12:00:08Z")

</div>

here I made picture from switch i wanted to use and also with the debug collecting data  
I like temporarily block the data from my domoticz system.'  
Slowly i'm learning how to use node maybe i use the wrong switch node or configured wrong.  
The switch in the picture in not configured.

 ![Capture1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8f2246f40a76aed283b4162e9276f0f763b16252.jpeg)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 January 2021 12:22 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/5 "2021-01-08T12:22:33Z")

</div>

If you want to block messages under some circumstances then have a look `node-red-contrib-simple-gate` which you can use to pass or block messages.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [8 January 2021 13:04 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/6 "2021-01-08T13:04:05Z")

</div>

> [@marconr9](#):
>
> The switch in the picture in not configured.

Well that doesn't help at all to know what you have configured.However, you could checl msg.`topic` to see if it contains 'domoticz'

---

<div class="post-metadata">

**Author:** ![marconr9](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marconr9/32/34116_2.png) [@marconr9](https://discourse.nodered.org/u/marconr9)\
**Post date:** [8 January 2021 15:12 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/7 "2021-01-08T15:12:48Z")

</div>

> [@Colin](#):
>
> node-red-contrib-simple-gate

Thanks Colin , that node-red-contrib-simple-gate was the node that I needed.  
And also thanks to zenofmud and Steve-MCi for helping me.

---

<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:** [9 March 2021 15:12 UTC](https://discourse.nodered.org/t/switch-node-red-losing-data/38783/8 "2021-03-09T15:12:50Z")

</div>

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