# Tasmota/Sonoff switch all 3 connected relays

**URL:** <https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779>\
**Category:** General\
**Created:** [17 May 2021 11:54 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779 "2021-05-17T11:54:15Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [17 May 2021 11:54 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/1 "2021-05-17T11:54:15Z")

</div>

My Generic Sonoff Module flashed with Tasmota switches 3 relays. I am using the switch node from _node-red-contrib-tasmota_ and I manage to switch the first relay (Relay1 on D1/GPIO5). So far so good...

Does anyone know how I can switch the other 2 relays with this?

![flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/0/a0a988b4e9c54f3f29c323d844fe9f5ed87c3bbf.png)

 ![generic-module](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/8/0805a2aff6a75d8eb2ad755a60ae72f2bc3a657b.png)

```auto
[{"id":"2b2a8e18.386cb2","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"f815bd72.6f9cb","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":110,"y":140,"wires":[["5aade1eb.eac8f"]]},{"id":"453bcff4.e5129","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":110,"y":60,"wires":[["5aade1eb.eac8f"]]},{"id":"5aade1eb.eac8f","type":"Tasmota Switch","z":"2b2a8e18.386cb2","broker":"d89d906b.7da19","device":"Sonoff213","name":"","outputs":1,"uidisabler":false,"fullTopic":"%topic%/%prefix%/","cmndPrefix":"","statPrefix":"","telePrefix":"","qos":1,"retain":false,"x":330,"y":100,"wires":[[]]},{"id":"d89d906b.7da19","type":"tasmota-mqtt-broker","name":"Tasmota Broker","broker":"192.168.2.160","port":"1883","clientid":"","usetls":false,"keepalive":"60","cleansession":true}]

```

---

<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:** [17 May 2021 12:45 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/2 "2021-05-17T12:45:37Z")

</div>

I don't know about that node, I use MQTT to communicate with tasmota devices. If you know the MQTT topics then that is very easy.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [17 May 2021 13:03 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/3 "2021-05-17T13:03:28Z")

</div>

Hi Colin. I have no preference, so using MQTT is good for me too. Below the output of the Tasmota console after pressing the three buttons in the Tasmota screen. Do you see the MQTT topics you mean in that output?

```auto
14:35:50 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:35:50","Uptime":"4T21:35:49","Heap":15,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":82,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:36:29 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:37:29 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:38:06 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:39:19 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:40:08 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:40:34 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:40:36 MQT: Sonoff213/tele/HASS_STATE = {"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:24:42","Core":"2_3_0","SDK":"1.5.3(aec24ac9)","Module":"Generic","RestartReason":"External System","Uptime":"4T21:40:35","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:06","MqttCount":1,"BootCount":82,"SaveCount":2586,"IPAddress":"192.168.2.213","RSSI":"82","LoadAvg":19}
14:40:50 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:40:50","Uptime":"4T21:40:49","Heap":15,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":82,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:41:36 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:42:32 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:45:08 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:45:36 MQT: Sonoff213/tele/HASS_STATE = {"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:24:42","Core":"2_3_0","SDK":"1.5.3(aec24ac9)","Module":"Generic","RestartReason":"External System","Uptime":"4T21:45:35","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:06","MqttCount":1,"BootCount":82,"SaveCount":2586,"IPAddress":"192.168.2.213","RSSI":"86","LoadAvg":19}
14:45:50 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:45:50","Uptime":"4T21:45:49","Heap":15,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":82,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:48:02 MQT: Sonoff213/stat/RESULT = {"Command":"Unknown"}
14:50:36 MQT: Sonoff213/tele/HASS_STATE = {"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:24:42","Core":"2_3_0","SDK":"1.5.3(aec24ac9)","Module":"Generic","RestartReason":"External System","Uptime":"4T21:50:35","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:06","MqttCount":1,"BootCount":82,"SaveCount":2586,"IPAddress":"192.168.2.213","RSSI":"84","LoadAvg":19}
14:50:50 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:50:50","Uptime":"4T21:50:49","Heap":15,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":84,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:55:36 MQT: Sonoff213/tele/HASS_STATE = {"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:24:42","Core":"2_3_0","SDK":"1.5.3(aec24ac9)","Module":"Generic","RestartReason":"External System","Uptime":"4T21:55:35","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:06","MqttCount":1,"BootCount":82,"SaveCount":2586,"IPAddress":"192.168.2.213","RSSI":"90","LoadAvg":19}
14:55:50 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:55:50","Uptime":"4T21:55:49","Heap":15,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":82,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:59:30 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:59:30","Uptime":"4T21:59:29","Heap":13,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"ON","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":82,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:59:30 MQT: Sonoff213/stat/RESULT = {"POWER1":"ON"}
14:59:30 MQT: Sonoff213/stat/POWER1 = ON
14:59:30 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:59:30","Uptime":"4T21:59:29","Heap":13,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":35,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":88,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:59:30 MQT: Sonoff213/stat/RESULT = {"POWER1":"OFF"}
14:59:30 MQT: Sonoff213/stat/POWER1 = OFF
14:59:33 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:59:33","Uptime":"4T21:59:32","Heap":13,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":30,"POWER1":"OFF","POWER2":"ON","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":84,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:59:33 MQT: Sonoff213/stat/RESULT = {"POWER2":"ON"}
14:59:33 MQT: Sonoff213/stat/POWER2 = ON
14:59:34 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:59:34","Uptime":"4T21:59:33","Heap":13,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":45,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":90,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:59:34 MQT: Sonoff213/stat/RESULT = {"POWER2":"OFF"}
14:59:34 MQT: Sonoff213/stat/POWER2 = OFF
14:59:37 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:59:37","Uptime":"4T21:59:36","Heap":13,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":24,"POWER1":"OFF","POWER2":"OFF","POWER3":"ON","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":82,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:59:37 MQT: Sonoff213/stat/RESULT = {"POWER3":"ON"}
14:59:37 MQT: Sonoff213/stat/POWER3 = ON
14:59:37 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T14:59:37","Uptime":"4T21:59:36","Heap":13,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":34,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":88,"LinkCount":1,"Downtime":"0T00:00:06"}}
14:59:37 MQT: Sonoff213/stat/RESULT = {"POWER3":"OFF"}
14:59:37 MQT: Sonoff213/stat/POWER3 = OFF
15:00:37 MQT: Sonoff213/tele/HASS_STATE = {"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:24:42","Core":"2_3_0","SDK":"1.5.3(aec24ac9)","Module":"Generic","RestartReason":"External System","Uptime":"4T22:00:36","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:06","MqttCount":1,"BootCount":82,"SaveCount":2590,"IPAddress":"192.168.2.213","RSSI":"86","LoadAvg":23}
15:00:51 MQT: Sonoff213/tele/STATE = {"Time":"2021-05-17T15:00:51","Uptime":"4T22:00:50","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER1":"OFF","POWER2":"OFF","POWER3":"OFF","Wifi":{"AP":1,"SSId":"TIS","BSSId":"2C:91:AB:A0:A6:C0","Channel":6,"RSSI":86,"LinkCount":1,"Downtime":"0T00:00:06"}}

```

---

<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:** [17 May 2021 13:07 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/4 "2021-05-17T13:07:00Z")

</div>

I meant the topics you need to use to tell the device to drive the relays.

> [@HaVi](#):
>
> `14:59:37 MQT: Sonoff213/stat/RESULT = {"POWER3":"ON"}`

Those are probably a clue. You possibly need to use the cmnd versions of those. I imagine the tasmota wiki has all that information on it.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [17 May 2021 13:30 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/5 "2021-05-17T13:30:10Z")

</div>

I can't find them Colin so I couldn't make it work that way. Hence I didn't communicate via MQTT but tried with that node from _node-red-contrib-tasmota_.

Maybe someone else has a solution, please let me know!

---

<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:** [17 May 2021 15:12 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/6 "2021-05-17T15:12:18Z")

</div>

node-red-contrib-tasmota uses MQTT. So anything it can do you can do using MQTT directly.  
I see the Generic node in that package of nodes can send arbitrary MQTT messages, but that won't help you if you don't know what topics to use.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [17 May 2021 16:37 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/7 "2021-05-17T16:37:21Z")

</div>

Is the topic not _Sonof213/cmnd/_ as shown in the admin screen of Tasmota:

 ![Sonoff](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/f/5fd4d26428dc950ced7ae8f458c96e6bd8c24198.png)

Then when I watch with MQTT-FX I see _Sonoff213/ cmnd/POWER1_ to _Sonoff213/cmnd /POWER3_:

 ![MQTT-FX](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/36571e75b702d9d69cd2d76b40f6f49e93783ce9.png)

I (also) tried that topic, unfortunately without succes. If the topic is indeed _Sonof213/cmnd/_, do you know how to use it in Node-RED to switch the 3 separate relays?

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [17 May 2021 16:43 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/8 "2021-05-17T16:43:39Z")

</div>

OK first of all - looks like you are using an embedded node from the HA version of Node Red.

Secondly - it is EXTREMELY old build of Tasmota - i would update the image on the unit first.

Lastly - if you are using a Sonoff basic - i assume you realise that it only has 1 relay on the board - the other pins have to be wired up/soldered to - to enable you to access them for switching etc ?

Craig

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [17 May 2021 20:07 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/9 "2021-05-17T20:07:00Z")

</div>

You can't use the Sonoff node anymore because you flashed your Sonoff device with Tasmota, you have to use now MQTT or http

To send a command to Tasmota over MQTT you always need to use the **cmnd** topic, not the tele or state topic.

So in your case you have to send payload **ON** to the **Sonoff213/cmnd/power1** topic for relay 1.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [18 May 2021 00:57 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/10 "2021-05-18T00:57:35Z")

</div>

have you tried

topic = Sonof213/cmnd/POWER2  
payload= "ON" or 1

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2021 11:33 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/12 "2021-05-18T11:33:34Z")

</div>

Now I am using a Wemos D1 Mini with Tasmota latest version and 3 LEDs on D1, D2 and D3. The topic set in Tasmota is now "Zonnescherm" and no longer "Sonoff213". This all works well from the Tasmota screen, I can switch all the LEDs individually.

I have followed the advice to switch with the MQTT node. Unfortunately, it still does not work, not even with the advice you have advised.

Any help is welcome!

 ![module](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/4/540e13b48d7a83e98b90cfb268f24da2ef015ff5.png)

 ![mqtt](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c6c20641e605198a7361fd1e0e4b5db8a818474c.png)

```auto
[{"id":"2b2a8e18.386cb2","type":"tab","label":"Tasmota","disabled":false,"info":""},{"id":"453bcff4.e5129","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":130,"y":60,"wires":[["b00c4295.fb856"]]},{"id":"b00c4295.fb856","type":"mqtt out","z":"2b2a8e18.386cb2","name":"","topic":"Zonnescherm/cmnd/POWER1","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e867dbc3.269d78","x":320,"y":60,"wires":[]},{"id":"e867dbc3.269d78","type":"mqtt-broker","name":"MQTT EchtSing","broker":"192.168.2.160","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

 ![flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/fe4f80328b0001c14b187ee0e0e5f64e2d27b95b.png)

---

<div class="post-metadata">

**Author:** ![Ranki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ranki/32/41282_2.png) [@Ranki](https://discourse.nodered.org/u/Ranki)\
**Post date:** [18 May 2021 12:36 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/13 "2021-05-18T12:36:05Z")

</div>

Hello @HaVi ,

what is your %prefix%? You should include it to adress the device via MQTT .

Do you have a MQTT Explorer to check the complete adress and double check the commands to send?

Cheers  
Ranki

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2021 13:17 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/14 "2021-05-18T13:17:58Z")

</div>

Hi Ranki, is this screendump as generated by MQTT Explorer helpfull? It shows what happens if I press the 3 Toggle Buttons from the Tasmota screen. As you can see "Zonnescherm" is shown twice (top and bottom).

 ![explorer](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/8/c8e6fb0679325a2328fc5efe76a52facd56c2ed7.jpeg)

---

<div class="post-metadata">

**Author:** ![Ranki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ranki/32/41282_2.png) [@Ranki](https://discourse.nodered.org/u/Ranki)\
**Post date:** [18 May 2021 13:31 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/15 "2021-05-18T13:31:53Z")

</div>

Hello @HaVi,

I am not at my computer now, but I guess your prefix is Tele and you are sending with `prefix = stat`. But I do not see why in your flow; have to import it at home. Maybe you can check on your own, if you find `stat` anywhere (maybe the MQTT-config node?).

What do you see, if you provide a message via node-red? Do you see the „stat“-messages are updating?

Cheers  
Ranki

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2021 14:03 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/16 "2021-05-18T14:03:20Z")

</div>

The stat-message is indeed being updated and I think I have tried all the topics by now. It is time that I conclude my knowledge of NodeRED and MQTT is insufficient and that I should do this in a different way 🙃

Anyway thanks for your advice!

```auto
[{"id":"2b2a8e18.386cb2","type":"tab","label":"Tasmota","disabled":false,"info":""},{"id":"453bcff4.e5129","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":130,"y":60,"wires":[["b00c4295.fb856"]]},{"id":"b00c4295.fb856","type":"mqtt out","z":"2b2a8e18.386cb2","name":"","topic":"stat/Zonnescherm/POWER1","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e867dbc3.269d78","x":360,"y":100,"wires":[]},{"id":"65890aa.d97c5f4","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":130,"y":120,"wires":[["b00c4295.fb856"]]},{"id":"e867dbc3.269d78","type":"mqtt-broker","name":"MQTT EchtSing","broker":"192.168.2.160","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

---

<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:** [18 May 2021 14:29 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/17 "2021-05-18T14:29:57Z")

</div>

> [@HaVi](#):
>
> my knowledge of NodeRED and MQTT is insufficient

It isn't your knowledge of node red or MQTT that is the problem, it is the fact that you don't know what topic the device requires you to use in order to control the outputs. That is purely a Tasmota question. Have you got a link to the tasmota wiki page where it tells you how to switch the normal relay using mqtt?

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2021 15:09 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/18 "2021-05-18T15:09:10Z")

</div>

Yes Colin switching one relay is no problem, the flow below works and switches the D1 pin of the Wemos:

```auto
[{"id":"2b2a8e18.386cb2","type":"tab","label":"Tasmota","disabled":false,"info":""},{"id":"453bcff4.e5129","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":150,"y":60,"wires":[["7db3e2ca.5e038c"]]},{"id":"65890aa.d97c5f4","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":150,"y":120,"wires":[["7db3e2ca.5e038c"]]},{"id":"7db3e2ca.5e038c","type":"Sonoff device","z":"2b2a8e18.386cb2","mode":"0","broker":"e867dbc3.269d78","device":"Zonnescherm","name":"","onValue":"ON","offValue":"OFF","cmdPrefix":"cmnd","statPrefix":"stat","telePrefix":"tele","x":420,"y":100,"wires":[[]]},{"id":"e867dbc3.269d78","type":"mqtt-broker","name":"MQTT EchtSing","broker":"192.168.2.160","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

It uses the node from _node-red-contrib-sonoff-tasmota_. Following the above advice of edje11 I did not use this node although it works with one relay / LED (on pin D1).

---

<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:** [18 May 2021 15:24 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/19 "2021-05-18T15:24:57Z")

</div>

When you use that to switch the relay, you should see what it is sending in MQTT Explorer.  
**[Edit]** You should see two results in Explorer, you should see the command and then the response from the device showing the new state. It is the command you need, which will likely have cmnd in the topic. My guess is that it will start with cmnd.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2021 15:57 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/20 "2021-05-18T15:57:15Z")

</div>

Below the result (MQTT Explorer) when I toggle button 1 in the Tasmota screen:

![explorer](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/6774c11c14e2ad7b0974c4e7971088e982da5dd0.png)

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2021 16:06 UTC](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779/21 "2021-05-18T16:06:52Z")

</div>

Yes Colin, that was the key to find the right topic. Solved! **Thank you very much again.**

For those with the same issue, here is the flow:

```auto
[{"id":"2b2a8e18.386cb2","type":"tab","label":"Tasmota","disabled":false,"info":""},{"id":"e4d312ed.a4c3a","type":"mqtt out","z":"2b2a8e18.386cb2","name":"D2","topic":"cmnd/Zonnescherm/POWER2","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e867dbc3.269d78","x":270,"y":220,"wires":[]},{"id":"6639171c.b9fbf8","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":110,"y":180,"wires":[["e4d312ed.a4c3a"]]},{"id":"5ef9d1e7.3f50f","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":110,"y":220,"wires":[["e4d312ed.a4c3a"]]},{"id":"36da8e16.52a2b2","type":"mqtt out","z":"2b2a8e18.386cb2","name":"D3","topic":"cmnd/Zonnescherm/POWER3","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e867dbc3.269d78","x":270,"y":360,"wires":[]},{"id":"f5aebae2.560e38","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":110,"y":320,"wires":[["36da8e16.52a2b2"]]},{"id":"aac5bed3.b9118","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":110,"y":360,"wires":[["36da8e16.52a2b2"]]},{"id":"43a121a4.1aaeb","type":"mqtt out","z":"2b2a8e18.386cb2","name":"D1","topic":"cmnd/Zonnescherm/POWER1","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"e867dbc3.269d78","x":270,"y":80,"wires":[]},{"id":"c2988cc2.14b6f","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":110,"y":40,"wires":[["43a121a4.1aaeb"]]},{"id":"64bb0fcb.a108f","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"OFF","payloadType":"str","x":110,"y":80,"wires":[["43a121a4.1aaeb"]]},{"id":"c973f96b.791758","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TOGGLE","payloadType":"str","x":120,"y":400,"wires":[["36da8e16.52a2b2"]]},{"id":"c4716bdc.2f0f98","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TOGGLE","payloadType":"str","x":120,"y":260,"wires":[["e4d312ed.a4c3a"]]},{"id":"6764ec3a.6c7714","type":"inject","z":"2b2a8e18.386cb2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"TOGGLE","payloadType":"str","x":120,"y":120,"wires":[["43a121a4.1aaeb"]]},{"id":"e867dbc3.269d78","type":"mqtt-broker","name":"MQTT EchtSing","broker":"192.168.2.160","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]

```

 ![NR](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/a/7a2e27d009eec964b138a119b132afd479297304.png)

[Next page](https://discourse.nodered.org/t/tasmota-sonoff-switch-all-3-connected-relays/45779.md?page=2)
