Do what it shows in the video. When you open the relay with a push button and the bulb no longer turns on when you press the wall switch, short-circuit S1 and S2 and tell me what happens.
Added after 2 [minutes]:
ferbulous wrote: So toggling switch only toggles the light bulb but not the relay, and the relay has to be on to work.
By shorting S1 and S2 we will see if the relay is activated or not.
Momentary short circuit, do not hold. Added after 25 [minutes]:If the relay is activated by short-circuiting momentarily, the RC value of the trigger must be decreased. Either by reducing the value of the 56K resistor or the 470uF capacitor, so that the optocoupler LED turns off during the negative half cycle of the wave.
Added after 1 [hours] 15 [minutes]:This is the setup I've tried.
With the diode in that position, Sonoff stays online both when I turn the wall switch ON and OFF.
In the OFF position, the bulb blinks, but that is logical because it only works with half wave. It is corrected with capacitor and diode.
But there is a big problem: You can't control the bulb with the wall switch, it only supports remote control via web.
So you have to add the trigger circuit to be able to control the bulb via S1-S2. I haven't been able to do this test because I don't have an optocoupler.
If I reverse the position of the diode, everything works like the classic series assembly where the power to Sonoff is provided through the wall switch in the ON position. So it can be controlled remotely, but when the switch turns OFF, Sonoff loses connection. In this way you have manual control of turning the bulb on and off, but remotely only if the wall switch is ON. That's how I've had it so far and it's fine for me.
Greetings