Step 1: Wire a Plug
Connect the live wire of the power plug to the live terminal of Sonoff TH.
Connect the neutral wire of the power plug to the neutral terminal of Sonoff TH.
If it’s a three pin plug, you need to connect the earth wire of it to the earth terminal of Sonoff TH.
Step 2: Connect the fan to Sonoff TH.
The way is the same as that of Step one.
Respectively connect the live, neutral or earth (if any) wire of the fan to the correct screw terminals of Sonoff TH respectively.
Step 3: Plug Sonoff sensor into Sonoff TH.
There are two Sonoff sensors, AM2301 and DS18B20. The former can measure temperature and humidity but it’s non-waterproof, while the latter is waterproof but it can only measure temperature.
So according to your need, select the right Sonoff sensor to plug to Sonoff TH. Here, I take AM2301 for example.
Step 5: Add Sonoff TH to E-WeLink
Hit the “Add device” button in this APP, and then press and hold the “Set” button of Sonoff TH for a few seconds. Select your WiFi account and enter the password. Name your device and lastly, click “ok”.
Step 6: Set the temperature boundary conditions
You’ll notice this APP can show you the real-time temperature value. Just click the device to set the temperature boundary conditions. Here, I make the temperature >= 35 ℃ asTurn On and <=30 ℃ as Turn Off.
Note that you have to keep your Sonoff TH power supply plugged in all the time.
Ok, now, a great fan with temperature control is done. When the temperature is higher than the value you set up, the fan will launch automatically. Also, you can turn on or turn off the fan through your phone via WiFi wherever you are. By the way, Sonoff TH has a timing function.
https://www.itead.cc/blog/how-to-diy-a-temperature-controlled-fan