# Double switch with mqtt -\> endless loop

**URL:** <https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741>\
**Category:** General\
**Created:** [25 April 2022 06:01 UTC](https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741 "2022-04-25T06:01:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [25 April 2022 06:01 UTC](https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741/1 "2022-04-25T06:01:26Z")

</div>

Hi,  
I want to build a very simple switch for both RPi.  
So I have to send the status (false/true) by mqtt.

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/e/7ecb1a4544a7a0d037acee491042afbbcb502fc7.png)

But I always get a endless loop 🥴

Any idea how to get this work ? (tried switch and slider)  
I want to switch the switches from both RPi, and the state should be displayed on both RPi correctly in the switch/slider. 😬

Without passing trough to output, the state isn´t correct.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [25 April 2022 06:15 UTC](https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741/2 "2022-04-25T06:15:07Z")

</div>

Um,

I think there is more here than you are saying. No problems.

I have just made something like what you have on two machines and it works.

What is catching me up is the actual node you are using (the blue one)  
It isn't a `slider` or `button`.  
More something like a schedule node.

If you are using the `slider` node I would suggest you set the option to only send on release.  
But I digress.... I don't think that is part of **THIS** problem.

What do you mean by _Endless loop_ though?

---

<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:** [25 April 2022 06:47 UTC](https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741/3 "2022-04-25T06:47:56Z")

</div>

Don't allow pass through on the UI nodes. & Change the inject to connect to the MQTT out instead of the UI node.

Or. Try an RBE before the blue UI nodes.

In truth, the better solution is to use a separate topics. 1 to command and another for status.

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [25 April 2022 08:57 UTC](https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741/4 "2022-04-25T08:57:39Z")

</div>

> [@Steve-Mcl](#):
>
> In truth, the better solution is to use a separate topics. 1 to command and another for status.

thats it, as my charging station (openWB) it does with all mqtt:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/5/a5a51329cbbb6c7a5975bd0f34de4d805ceb3253.png)

openWB/config/get/pv/lp/1/maxSoc \<--\> openWB/config/set/pv/lp/1/maxSoc

But I don´t get it with 2 topics, can you give me an example @Steve-Mcl

---

<div class="post-metadata">

**Author:** ![Becker](https://avatars.discourse-cdn.com/v4/letter/b/c77e96/32.png) [@Becker](https://discourse.nodered.org/u/Becker)\
**Post date:** [25 April 2022 09:42 UTC](https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741/5 "2022-04-25T09:42:41Z")

</div>

i think i got it:

 ![11](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/2/32f604b5531541a72ef5177139fa934bed808ab4.jpeg)

1.: pass through output  
2.: do not pass through output

---

<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 May 2022 09:43 UTC](https://discourse.nodered.org/t/double-switch-with-mqtt-endless-loop/61741/6 "2022-05-09T09:43:33Z")

</div>

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