How to Install and Set Up Your Sonoff Device in Minutes

Understanding Sonoff’s Core Components and Compatibility

Before initiating the installation, verify that your Sonoff device is genuine—counterfeit units lack firmware support and safety certifications. Sonoff products typically include a relay module (eWiFi, Basic, Mini, or TH), a power supply, and a quick-start guide. Check compatibility with your home Wi-Fi network: Sonoff devices operate on 2.4 GHz frequency bands only; 5 GHz networks are unsupported. If your router broadcasts both bands, ensure your smartphone connects to the 2.4 GHz SSID during setup. Additionally, confirm that your electrical system matches the device rating—standard Sonoff relays handle 10A at 250V AC, sufficient for most household lamps and small appliances. For high-power devices (heaters, pumps), the Sonoff POW series with energy monitoring and higher current capacity is required.

Step 1: Physical Installation—Mounting and Wiring Safely

Safety first: Disconnect the main circuit breaker before touching any wires. Use a voltage tester to confirm zero potential at the installation point.

For a Sonoff Basic or TH (used for switching a single light or fan):

  • Identify the live (brown/red) and neutral (blue/black) wires in the junction box.
  • Connect the incoming mains live to the Sonoff’s “L” input terminal.
  • Connect the incoming mains neutral to the “N” input terminal.
  • Connect the load’s (light/fan) live wire to the “L’ ” output terminal.
  • Connect the load’s neutral wire to the “N’ ” output terminal (some models combine neutral).
  • Tighten screws firmly; loose connections cause arcing.

For a Sonoff Mini (fits behind existing wall switches):

  • Keep the existing switch in place—it becomes a physical controller.
  • Wire the mains live to “L-in” and neutral to “N-in.”
  • Wire the switch’s two terminals to “S1” and “S2” on the Mini.
  • Connect the load to “L-out” and ensure neutral continuity.

For dual-load applications (e.g., Sonoff 4CH Pro):

  • Repeat the single-channel wiring for each circuit.
  • Use a 5V USB power supply for the module’s logic board if required (check model specifications).

Mounting: Enclose the module in a certified electrical box (IP54 or higher for outdoor use). Avoid metal enclosures that may dampen Wi-Fi signal. Use cable glands to prevent strain on terminals.

Step 2: Powering On and Initial Wi-Fi Configuration

Restore circuit breaker power. The Sonoff LED will blink rapidly (approximately 2 blinks per second), indicating “Pairing Mode.” If it does not, press and hold the physical button on the module for 5 seconds until the LED flashes.

Using the eWeLink App (Official Method):

  1. Download “eWeLink – Smart Home” from the Apple App Store or Google Play Store.
  2. Create an account using your email or phone number—this is mandatory for remote access. Verify via the confirmation code.
  3. Tap “Add Device” (+) in the top-right corner. Select “Manual” scanning.
  4. Choose “Lighting – Wi-Fi” or “Socket – Wi-Fi” depending on your device type.
  5. Confirm the device’s LED is in rapid-blink mode (pairing).
  6. Enter your 2.4 GHz Wi-Fi SSID and password. Avoid special characters in the password; use only alphanumeric and standard symbols.
  7. For Touch configuration: Hold your smartphone close to the Sonoff device. The app uses sound waves to transmit credentials. Ensure no loud background noise.
  8. For AP mode (alternative): Toggle the switch in the app to “AP Mode.” The Sonoff creates a temporary hotspot (ST_xxxxxx). Connect your phone’s Wi-Fi to that hotspot, then return to the eWeLink app to complete setup.
  9. Wait 10–30 seconds for the LED to turn solid (non-blinking). The device appears in the app interface.

Troubleshooting timeouts: If the app fails after three attempts, power-cycle the Sonoff (unplug/replug or toggle breaker) and reset by holding the button until the LED blinks twice quickly, then release. Retry with the phone within 3 feet of the device.

Step 3: Advanced Connectivity—Alternative Firmware (Tasmota or ESPHome)

For advanced users seeking local control, MQTT integration, or avoidance of cloud dependency, flash custom firmware. This voids warranty and requires a USB-to-Serial adapter (e.g., FTDI232, CH340G) and soldering skills.

Flashing Tasmota via Serial:

  • Open the Sonoff case using a spudger. Locate the four programming pads (RX, TX, VCC, GND) near the ESP8266 chip.
  • Solder header pins onto these pads, or use pogo pins with a jig.
  • Connect the adapter: VCC (3.3V) to Sonoff VCC, GND to GND, TX to RX, RX to TX. Do not use 5V – the ESP8266 is 3.3V logic.
  • Use a tool like Tasmotizer (GUI) or esptool.py. Select the correct COM port and baud rate (115200 is standard).
  • Erase flash, then write the Tasmota firmware file (.bin or .gz). Ensure the file matches the Sonoff model (sonoff-mini.bin, sonoff-basic.bin, etc.).
  • After flashing, connect the Serial adapter’s GPIO0 to GND momentarily to enter configuration mode.
  • Connect to the “tasmota-xxxx” Wi-Fi hotspot. Open 192.168.4.1 in a browser, set your Wi-Fi credentials, and assign a static IP if desired.

Configuring MQTT in Tasmota:

  • Access the Tasmota webUI via the device’s IP address.
  • Go to Configuration → MQTT. Enter your broker’s IP (e.g., Home Assistant, Mosquitto), username, password, and topic (e.g., sonoff/ktichen/light).
  • Enable “Telemetry period” and set to 300 seconds for energy monitoring devices.
  • Save and reboot. Use MQTT Explorer to verify topics (cmnd/…, stat/…, tele/…).

Step 4: Integration with Smart Home Ecosystems

Amazon Alexa and Google Home (via eWeLink cloud):

  • In the eWeLink app, navigate to Profile → Third-Party Services.
  • Link your Alexa or Google Home account. You will be redirected to a login page. Grant permissions for device discovery.
  • Once linked, say “Alexa, discover devices.” The Sonoff appears as a switch or light.
  • Create routines: “Turn on kitchen light when motion detected” if using a Sonoff sensor.

Home Assistant (Local Control via ESPHome or MQTT):

  • For eWeLink devices, use the “Sonoff LAN” integration (HACS) to control locally without cloud.
  • For Tasmota devices: add MQTT integration in Home Assistant (Configuration → Integrations → MQTT). Sensors appear automatically via auto-discovery.
  • For ESPHome: flash the ESPHome firmware with a YAML configuration (Example: binary_sensor: - platform: gpio pin: GPIO0 name: "Switch"). Compile and flash via OTA or serial.

Apple Home (HomeKit):

  • Sonoff does not natively support HomeKit. Use Homebridge on a Raspberry Pi or NAS. Install the “homebridge-sonoff” plugin with your eWeLink credentials, or the “homebridge-tasmota” plugin for direct local control.

Step 5: Firmware Updates and Security Hardening

updating official firmware:

  • In eWeLink, go to Settings → Device Update. Run the check. Updates fix bugs and patch vulnerabilities. Do not interrupt power during an update.
  • If the device becomes unresponsive after an update, factory reset (hold button 10 seconds until LED blinks twice).

Securing custom Tasmota firmware:

  • Change the default webUI password (Configuration → Configure Other → Set Password).
  • Disable HTTP access if using HTTPS or local-only LAN. In Tasmota, set SetOption54 1 to disable HTTP.
  • Enable “MQTT TLS” if your broker supports encryption. Generate self-signed certificates and upload via the Tasmota firmware’s webUI.
  • Restrict Wi-Fi access by assigning the Sonoff device to a VLAN or a separate IoT network that cannot initiate outbound connections to the internet (only needed for local MQTT/mDNS).

Energy monitoring calibration (Sonoff POW):

  • If your device supports energy monitoring, calibrate it against a known load. In Tasmota, use the “Power Calibration” command: PowerSet 100 for a 100W bulb, then adjust VoltageSet and CurrentSet in the console until the reported wattage matches the reference.

Step 6: Voice Control and Advanced Automation

Creating local automations with Sonoff RF Bridge:

  • Pair Sonoff RF remotes or sensors (door/window) with the RF Bridge in eWeLink.
  • In the app, create “Scenes” or “Automations”: “If RF sensor triggers, turn on Sonoff Basic.”
  • For Tasmota, use rule-based triggers. Example rule: on tele-RFReceived#Data do publish cmnd/sonoff-basic/POWER %value% endon.

Integrating with IFTTT:

  • Sonoff eWeLink supports IFTTT applets. Connect accounts and create triggers like “If weather forecast predicts rain, turn off Sonoff-connected sprinklers.”
  • Note: IFTTT introduces up to 5-second latency—not suitable for time-critical tasks.

Auto-off timers and schedules:

  • Set timers directly within the eWeLink app: tap the device, select “Timer,” choose a time, and select action (on/off). Use “Countdown” for immediate timed switching.
  • For Tasmota, use the built-in timer: Timer1 60 for a 60-second countdown to turn off the relay.

Step 7: Diagnosing Common Issues Without Calling Support

Device not pairing:

  • Check that your phone’s location services are enabled (Android requires them for Wi-Fi scanning).
  • Temporarily disable mobile data while pairing—some phones switch to cellular.
  • Verify your router is not blocking UDP ports 1024–65535. Disable “AP Isolation” in router settings.
  • Reset the device completely: after powering on, press and hold the button for >10 seconds until the LED blinks twice and then stays on. Release. The device resets to factory defaults.

LED blinking but no response:

  • This indicates Wi-Fi credentials are stored but the device cannot connect to the router. Check router uptime, SSID broadcast, and signal strength. Use a Wi-Fi analyzer app (e.g., Wi-Fi Analyzer on Android) to confirm the 2.4 GHz channel is not congested (channels 1, 6, or 11 preferred).
  • If devices are too far from the router, install a Wi-Fi repeater or move the Sonoff closer—metal walls and concrete significantly attenuate 2.4 GHz signals.

Relay clicking but load not toggling:

  • The relay is actuating, but the load circuit may have a loose neutral or live connection. With power off, recheck wiring. A multimeter in continuity mode can verify that the relay output terminal connects to the load when activated.
  • The load may be incompatible—some LED bulbs with large inrush current cause the Sonoff’s SSR (if equipped) to latch. Replace with a relay-based Sonoff (Basic or Mini) instead.

Step 8: Power Backup and Offline Operation

Using a Sonoff without internet (local control only):

  • In Tasmota, set SetOption0 0 to disable MQTT and keep the webUI operational. Use the local IP address in a browser to toggle the relay. Bookmark the IP for quick access.
  • For eWeLink devices, enable “LAN Control” in device settings. Use the eWeLink app on the same network only—cloud dependency is bypassed for toggle commands.

Adding a battery backup (critical for alarms):

  • Sonoff devices run on mains power; a power outage stops all functionality. For critical loads (garage door, security siren), install a Sonoff TH with a 5V backup battery connected to the USB port. Configure the TH to trigger when mains drops (power failure detection) and send a notification via MQTT.

Step 9: Multi-Device Synchronization and Groups

Creating a group in eWeLink:

  • In the app, tap “Create Group” from the main device list.
  • Select multiple Sonoff switches (up to 20 per group). Assign a group name (e.g., “Living Room Lamps”).
  • Now, one tap turns all devices on/off together. Voice commands like “Alexa, turn on Living Room Lamps” work for the entire group.
  • For Tasmota devices, use the “GroupTopic” feature. Set GroupTopic LivingRoom on each device. Then publish to cmnd/LivingRoom/POWER to control all simultaneously.

Synchronizing with scenes:

  • In eWeLink, create a “Scene” (e.g., “Goodnight”). Set actions: turn off all lights, set Sonoff TH to 72°F, and lock the Sonoff RF shutdown.
  • Scenes run instantly from the app or triggered by sensors. Sonoff scenes support delay sequencing (up to 60 seconds between actions).

Step 10: Expanding Beyond Switching—Sensor and Actuator Integration

Adding temperature/humidity sensors (Sonoff TH):

  • Plug a DS18B20 or AM2301 sensor into the Sonoff TH’s RJ9 port.
  • In eWeLink, the sensor data appears in the device dashboard. Set thresholds: “If temperature > 35°C, turn on fan.”
  • For Tasmota, map the sensor in the configuration: DallasGPIO 14 (for DS18B20) or AM2301 GPIO 14. Telemetry sends data every 5 minutes.

Controlling high-power motors via contactor:

  • A Sonoff Basic (10A) cannot handle a pump motor’s starting current (up to 40A). Wire the Sonoff’s output to a contactor coil (24V AC or 230V AC depending on contactor). The contactor’s main contacts switch the motor. This isolates the high current from the Sonoff.

Using Sonoff motion sensors (PIR):

  • Pair the Sonoff SNZB-01 motion sensor via Zigbee bridge (Sonoff ZBBridge). In eWeLink, create an automation: “When motion detected, turn on Sonoff Basic for 5 minutes.”
  • For Tasmota, the Zigbee bridge publishes MQTT messages. Parse with rules: on mqtt:zigbee2mqtt/motion_sensor/action do publish cmnd/sonoff-basic/POWER ON endon.

Leave a Comment