This assembly is universal. Suitable for all types of AC devices.
You can control the device manually through SW1 but remotely only when SW1 Closed.
And you need to configure Startup like this:
When SW1 opened, Sonoff Offline. In order for Sonoff to stay in line with SW1 Open, we added D1.
Now with SW1 closed the bulb turns on normally, but when SW1 is open the bulb flashes. To correct that we add this:
R3 limits the current through D7 when C2 is discharged when the device is connected to the AC mains. C2 charges through D7 during the AC positive half cycle and begins to discharge through the bulb during the 10 millisecond AC negative half cycle. The bulb is running on DC despite being an AC device (explained later).
We already eliminated the flicker but when opening or closing SW1 the bulb stays on. We need a trigger:
But for it to work we need to configure this:
Now we can turn the bulb on and off by controlling Sonoff via S1-S2. When SW1 closed, T1 conducts and closes S1-S2. When SW1 open, T1 does not conduct and opens S1-S2.
Why are Sonoff and bulb working if they are AC devices?
Because they work internally at DC. That's why we can't connect a device that works internally with AC like a ceiling fan, for example. But there are DC fans, I think these could work with this assembly for the same reason that Sonoff and led bulb do.
AC devices work with assembly 1, which is universal, as long as the current consumed is less than what Sonoff's internal relay can withstand (usually 10 or 16A).
https://www.elektroda.com/rtvforum/topic3969629-30.html#20536819

You can control the device manually through SW1 but remotely only when SW1 Closed.
And you need to configure Startup like this:

When SW1 opened, Sonoff Offline. In order for Sonoff to stay in line with SW1 Open, we added D1.

Now with SW1 closed the bulb turns on normally, but when SW1 is open the bulb flashes. To correct that we add this:

R3 limits the current through D7 when C2 is discharged when the device is connected to the AC mains. C2 charges through D7 during the AC positive half cycle and begins to discharge through the bulb during the 10 millisecond AC negative half cycle. The bulb is running on DC despite being an AC device (explained later).
We already eliminated the flicker but when opening or closing SW1 the bulb stays on. We need a trigger:

But for it to work we need to configure this:

Now we can turn the bulb on and off by controlling Sonoff via S1-S2. When SW1 closed, T1 conducts and closes S1-S2. When SW1 open, T1 does not conduct and opens S1-S2.
Why are Sonoff and bulb working if they are AC devices?
Because they work internally at DC. That's why we can't connect a device that works internally with AC like a ceiling fan, for example. But there are DC fans, I think these could work with this assembly for the same reason that Sonoff and led bulb do.
AC devices work with assembly 1, which is universal, as long as the current consumed is less than what Sonoff's internal relay can withstand (usually 10 or 16A).
https://www.elektroda.com/rtvforum/topic3969629-30.html#20536819
Cool? Ranking DIY