# Node red master rules?

**URL:** <https://discourse.nodered.org/t/node-red-master-rules/36554>\
**Category:** General\
**Created:** [26 November 2020 11:17 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554 "2020-11-26T11:17:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattrix](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mattrix](https://discourse.nodered.org/u/mattrix)\
**Post date:** [26 November 2020 11:17 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/1 "2020-11-26T11:17:42Z")

</div>

Hello,  
I Have created a simple flow that lights on my lights via node red pulled by mosquitto mqtt.

But now i cannot use my physical switch becausenode red has control on it like it it was super master god.

What i am missing ?

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [26 November 2020 11:21 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/2 "2020-11-26T11:21:52Z")

</div>

You need to give us a bit more detail to work on as your description is very vague.

Post a flow if you can... but first read how to do that.

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![mattrix](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mattrix](https://discourse.nodered.org/u/mattrix)\
**Post date:** [26 November 2020 11:39 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/3 "2020-11-26T11:39:30Z")

</div>

Thanx but i dont htink i have json flow anyway, here is my flow.  
Again, when i switch off on physical switch, light does not switch off and does not switch on, it s working only on node red.  
That is propbably a common problem

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/780d3070c4974603bccea69fe3d0a34a7d80e01b.png)

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 November 2020 12:40 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/4 "2020-11-26T12:40:13Z")

</div>

> [@mattrix](#):
>
> Thanx but i dont htink i have json flow anyway

If you select the nodes that you have in the screenshot, and then export the flow, you will be able to paste it here (after reading the link which @dynamicdave posted above).  
Then we will be in a better position to help you.

---

<div class="post-metadata">

**Author:** ![mattrix](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mattrix](https://discourse.nodered.org/u/mattrix)\
**Post date:** [26 November 2020 14:06 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/5 "2020-11-26T14:06:17Z")

</div>

Many thanks for having thought me that.

Here is the xport

```auto
[{"id":"7fd7cdf0.caf594","type":"mqtt in","z":"76cadfed.d480b","name":"","topic":"homie/homey-topic/lumiere-pierre/onoff","qos":"2","datatype":"auto","broker":"1fbfef54.67f911","x":200,"y":260,"wires":[["e75c7b23.eb6008"]]},{"id":"e75c7b23.eb6008","type":"ui_switch","z":"76cadfed.d480b","name":"","label":"switchtt","tooltip":"","group":"c03090cf.c701","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"homie/homey-topic/lumiere-pierre/onoff/set","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":500,"y":240,"wires":[["22d9f121.1a6c9e"]]},{"id":"22d9f121.1a6c9e","type":"mqtt out","z":"76cadfed.d480b","name":"tt","topic":"homie/homey-topic/lumiere-pierre/onoff/set","qos":"","retain":"","broker":"1fbfef54.67f911","x":650,"y":240,"wires":[]},{"id":"5e0418fb.d7a988","type":"mqtt in","z":"76cadfed.d480b","name":"","topic":"#","qos":"2","datatype":"auto","broker":"1fbfef54.67f911","x":140,"y":160,"wires":[["612acb59.79f7f4"]]},{"id":"612acb59.79f7f4","type":"debug","z":"76cadfed.d480b","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":380,"y":140,"wires":[]},{"id":"1fbfef54.67f911","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.24","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"c03090cf.c701","type":"ui_group","z":"","name":"eclairage","tab":"f57a796f.da93d8","order":1,"disp":true,"width":"6","collapse":false},{"id":"f57a796f.da93d8","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![mattrix](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mattrix](https://discourse.nodered.org/u/mattrix)\
**Post date:** [27 November 2020 08:17 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/6 "2020-11-27T08:17:39Z")

</div>

OK i will try on reddit forum hoping to find answer, because it s kind of crazy thing

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [27 November 2020 09:55 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/7 "2020-11-27T09:55:02Z")

</div>

Let's assume that the output from the `homie/homey-topic/lumiere-pierre/onoff` MQTT node will be a string "true" or "false" (not Boolean `true` of `false`).

In your switch node you currently are testing for a Boolean value, so you need to change it to expect a string value, like;  
 ![switch](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f84436d0ed7fb87db559dadec9c2d1f78e2b06bc.jpeg)

Also as you are specifying the MQTT topic in the switch node, there's no need to also set it in the MQTT node.

---

<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:** [27 November 2020 10:01 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/8 "2020-11-27T10:01:52Z")

</div>

Also you should have the switch node configured with pass through disabled and to show the state of the input, otherwise you will get an mqtt loop.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/f/df2665f93790865283956c2636ef084509e9f76c.png)

---

<div class="post-metadata">

**Author:** ![mattrix](https://avatars.discourse-cdn.com/v4/letter/m/258eb7/32.png) [@mattrix](https://discourse.nodered.org/u/mattrix)\
**Post date:** [27 November 2020 10:41 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/9 "2020-11-27T10:41:49Z")

</div>

All solved now thank you both of you

---

<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:** [11 December 2020 10:41 UTC](https://discourse.nodered.org/t/node-red-master-rules/36554/10 "2020-12-11T10:41:52Z")

</div>

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