The Sonoff brand is a whole series os IOT devices that uses the esp8266 WiFi processor internally. The devices are cheap and are easily hacked. The simplest device is the Sonoff WiFi Smart Switch, which is a small device that can turn on or off 110/220 Volt 10 Ampere remotely. That means the you can have your ceiling fan, lamp or anything else connected t mains power remotely controlled by your phone. But the software that comes with it isn’t very flexible and can not be integrated to a home control system like NodeRED, OpenHAB or any other home automation system.
Fortunately the Sonoff devices are easily hacked, where you can put a better firmware like ESPEasy on it and integrate the device with any system. ESPEasy has an extensive list of extra modules that you can connect, like temperature, barometric pressure, humidity, light sensors, PIR sensors and a long list of other things.
But most modules connect with I2C, which is a serial interface for interconnecting ICs using a clock and a data line. The Sonoff Switch only have one extra pin available, making it impossible to connect more advanced sensors. But there is a way of fixing that. Here’s how to add that to add an I2C connector to your $5 Sonoff and open up a whole field of stuff you can do.