Check a Sonoff Dual via external buttons or switches

5 minutes of reading
Purposes of projet:
  • Check a dual channel switch Sonoff dual through the use of external switches and / or buttons
  • Difficulty level: low
  • Cost: did
Concepts dealt with:
  • Change to electronic device
Software components used:
Physical devices used:
Procasting more suitable for:

All environments

Notes and disclaimer
  • qualsiasi modifica all'impianto elettrico dev'essere progettata ed effettuata da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 2.2


The smart switches of the family ITEAD Sonoff Smart Home they are extremely versatile, very economical and functional domotic components, but when it comes to integrating them in existing systems may, sometimes, rappresent a proproblem, especially in the presence of one or more diverters.

Il Sonoff dual, specifically, is a actuator home automation double channel extremely versatile: it accepts the standard 220v network input and returns it selectively to the two available outputs. This allows you to control two different light points, two different electrical utilities or, in one of the most typical cases, the two directions of rotation in the motors of the tappelectric arrays.

Unlike the Sonoff Basic, which provides a physical change to be controlled by external buttons / switches, the Sonoff dual it greatly facilitates the task, as it has on its board contacts on which to testify one or more buttons and / or switches.

Sonoff Dual - Board - External contacts

This means that the two poles of a common switch or a common button can be eveningsnamebe connected to the contacts on the board (via connectors on the type cables Dupont) in order to check the behavior of the two actuator relays. It can also be used a double mechanical interlock button, which allows the two relays to be activated selectively, and thus manage the descent and ascent of tapparelle.

Sonoff Dual - board contact details
detail of two connections (two pairs of cables)

As described regardless of domotic functions, which regardless of the presence or absence of switches and / or buttons continue to operate in an ordinary manner; as it is easy to imagine, the state of the relays controlled through the external contacts is vice versa detected by the domotic environment in a completely automatic way.

If it's all so simple, then why this guide?

The reason lies in the possible behavior of the relays with respect to closing / opening the contacts.

Nb It is important to note how the contacts proplaces from prodiatore on the board of Sonoff Dual be directly connected to SO ESP8266, heart of the system. Therefore, these contacts may be subject to electromagnetic interference that can give rise to unexpected behavior.
Sonoff Dual with double button
an example of a double button connection.


What first of all is necessary to distinguish is the intended use of Sonoff dual in question: use tapparelle (or the two channels interconnected and used in tandem) or use to single channels (to manage, as mentioned, lighting points, utilities or other).

Use with single channels

In this scenario essentially the Sonoff Dual behaves like a double switch: the behavior of each of the two channels can be customized regardless of the other. For this reason we will report the scheme proplace in the projet dedicated to the control with buttons / switches of a Sonoff Basic: it is basically the same thing.


This implementation involves the replacement of any pre-existing switch with a button (in the illustrated case of type "Normally Open“).

Let's look at the wiring diagram initial:

Switch-load diagram

and how becomes:

Scheme Sonoff Dual -loads - with buttons
Once implemented this change, the work is completed. Obviously it is possible to use even one channel, there is no obligation to use both.

To make the change work, however, it is necessary to implement:

  • su Sonoff dual with original firmware: nothing, it works by itself;
  • su Sonoff dual riprogrammato with firmware Tasmota: appuse the command "SWITCHMODE"

In the second case, the command is as follows:

cmnd/Sonoff/SwitchModeX 3

which will interpret the brief closure of the contacts (implemented through a button) such as "change of status compared to the current one". The "X" as a suffix to the command SwitchFashion indicates the channel (the first or second, respectively 1 or 2); the name "Sonoff”Must be modified based on the name assigned in the configuration Tasmota.

In case you use a button "Normally Closed", The command will be:

cmnd/Sonoff/SwitchModeX 4

This is done by pressing / releasing the button will be implemented TOGGLE of the relay status of the Sonoff (turns off if on, turns on if off); at the same time, the same command can be implemented at home automation. Obviously if the Sonoff be controlled manually, the new state will be correctly detected inside the home automation practically instantly.


If you decide, instead, to use a switch, then the scheme will be the following:

Scheme Sonoff Dual -loads - with switches

In this case, for a correct functionnameof the circuit and manual activation it's necessary the presence of the firmware on board Tasmota because only in the presence of such firmware it will be possible to implement a configuration that allows interpretation each change of state (any!) of the switch as TOGGLE.

Performed the highernamefirmware and wired the circuit as above, you will need to set it from the console Tasmota the following command (it is assumed that the device has a name "Sonoff"):

cmnd/Sonoff/SwitchModeX 1

which will provide for the closing or opening of the contacts connected to the switch as "change of status compared to the current one". The "X" as a suffix to the command SwitchFashion indicates the channel (the first or second, respectively 1 or 2); the name "Sonoff”Must be modified based on the name assigned in the configuration Tasmota.

For the rest (home automation control, state change detection in home automation etc.) the same considerations made in the example related to the button will be valid.

Use tapparelle

At this juncture the approccio changes. First of all, we take it for granted the use of two buttons (or a double one) as explained in the abstract: this is because the desired effect will be the one for which when one of the two is pressed, the relative channel delivers the voltage as long as the button is pressed, which will cause rotation in one direction of the motor; vice versa, the pressure of the other button must cause the activation of the other channel and therefore the rotation in the opposite direction.

What is fundamental is that the two channels cannot be activated simultaneously: this would cause the engine to break. To avoid this the roads are two:

In the first case, the button itself guarantees the interlock: basically, while a button is pressed the other cannot be physically activated, and viceversa; in the second case to manage the thing is the firmware: when a relay is activated, the other is blocked until the first is deactivated.

If you want to use the software interlock, the Sonoff Dual must necessarily be equipped of firmware Tasmota.
The command to use is the following:

cmnd/Sonoff/Interlock 1

command that, starting from the 6.5 version of Tasmota, provvede appunto the firmware management of the interlock function.

Nb about the functionnameof the double button - or the need forkeep pressed"As long as you want to raise / lower the tapparella, there are also other possibilities. Using for example the native inching mode at theapp eWeLink or la PULSETIME di Tasmota it is possible to predetermine a behavior that causes the actuator to press the button and then release it profor the given channel, see the timed delivery of the output voltage - and therefore the activation of the motor.

The argument è vasto a piacere: if you have clarifications, suggestions, addenda, corrections, please let us know.


In case of use of the Sonoff Dual with engines for tapparelle and similar, we recommend - more than firmware Tasmota - the adoption of the note fork of Tasmota by stefanbode. This is because, in addition to guaranteeing the classic features of the original Tasmota, the stefanbode fork guarantees the presence of the% opening parameter of tapparella, information that can also be registered by personal HUBlike Home Assistant and similar.


The techniques described in the present procast are valid, in the same way, also for i Sonoff Dual modified in clean contact - including those used to control tapparrays that do not provide direct power to 200v but only clean contact activation on two channels.

ITEAD Sonoff BasicATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Sonoff (and more generally to devices ESP8266), for any doubt, question, information on the specific merit of these components.


Stay up to date through ours Telegram channel!