In the market there are many manufacturers who have similar products. If anybody wishes to set up their own control system using incandescent light or electrical fan with your favorite ESP8266 over internet, Wifi and your smart device, this video will help you out. The speaker of this demo luckily issues a warning, just to be careful with Main Power supply as the device is connected to the same. If you dont have an idea, please do not try to replicate this design is what he suggests.
In this design,basically R1, R2 and D1 feed an optocoupler with AC signal clamped at 0.6V by D1 and the opto LED. Thus it produces a square signal crossing 0V when the Mains itself is at 0V. This signal is output on the isolated side of the optocoupler and is sent to the ESP8266.
ESP8266 is then computing a delay to switch on the MOC during a very short pulse. Doing this enables the triac to switch on only during a short fraction of the 50Hz (or 60Hz) period. The higher the delay the more the light is dimmed.
Here is an example showing an almost full brightness (most of the power is kept “ON”).
The developer just added a simple Android App to control the dimmer and surprisingly gets a very good response time off ESP8266.