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. So you can do stuff like have your ceiling fan remotely controlled by your phone, or switch on/off anything that is connected to mains power. 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. Unfortunately, the Sonoff Switch only has 1 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.