I need to control SONOFF using either physical buttons and switches and not only through OpenHAB
The easiest way is to use a button directly connected to the physical button pins in the SONOFF. I already made a test with my first SONOFF Basic, as described in a previous post(http://domoticsduino.blogspot.com/2017/08/home-automation-system-sonoff-and-mqtt_19.html).
In this way we could activate and deactivate SONOFF as we do using the physical button. But I need to control the SONOFF through switches too. Reading the TASMOTA documentation, I discovered that I could connect a button / switch to the GPIO14 pin. Then I could tell TASMOTA what kind of object I connected...if a standard button or a switch.
To do so, I have to connect the button / switch to the GPIO14 pin and to the GND pin on the board; both of them are easily reachable. The GPIO14 pin is the one which is not utilized on the serial interface, and the GND is just beside it (already used for the serial communication).
When the hardware link are OK, I have to configure TASMOTA
In the configuration menù of the web interface, I choose 09 Switch1 as the new value for GPIO14 drop down list.
Then, I have to set SwitchMode parameter accordly to my needs, through the Console: if I will work with a button, I set up the value 3, otherwise I will put 0
Here you can find many informations: https://github.com/arendst/Sonoff-Tasmota/wiki/Understanding-SwitchMode-and-SwitchTopic
And finally here is a video with my test