noafterglow edited this page Jul 19, 2018 · 36 revisions


  1. Download the latest Sonoff-Tasmota "Source code (zip)" and extract it - you may also git clone the repository
  2. Load the Sonoff-Tasmota base folder in PlatformIO
  3. Connect the Sonoff module in Flash Mode (see Hardware Preparation section and device specific articles)
  4. Select a firmware variant to flash onto your module by uncommenting one of the env_default lines in platformio.ini, see below for variant details. You may also need to change the upload_port to match the communications port of the USB serial interface.
  5. Open user_config.h and configure your WiFi settings and optionally your MQTT, Syslog, WebServer, NTP, etc. settings
  6. Select "Upload" from the menu to flash the firmware
  7. After successful transfer of the firmware disconnect the module

Continue at "First Steps" and be sure to check out the instructions to connect additional sensors.

Firmware Variants

The default environment configuration generates multiple firmware variants. To build and/or flash exactly one of these, uncomment one of the env_default lines in platformio.ini.

  • sonoff.bin - the default firmware for all devices
  • sonoff-minimal.bin - is interim firmware to be used when the above firmware images become too big to fit as OTA or web upload; installing this one first and THEN uploading the desired sonoff.bin allows for future firmware size growth over the OTA file limit of 1/2 flash size.
  • sonoff-ds18x20.bin - is a version of sonoff.bin with the USE_DS18X20 define enabled and a larger MQTT buffer size to be used by people having more than 4 ds18x20 sensors connected.

Arduino IDE

See the upload section from Arduino IDE in the right hand menu.

Continue at "First Steps" and be sure to check out the instructions to connect additional sensors.

Sonoff factory OTA Mechanism (experimental)

There's now also a script with which you can flash your freshly bought unmodified Sonoff device via the original internal OTA upgrade mechanism provided by the Itead firmware. No need to open and solder header pins, no need for a serial programmer.

For further details see:

Device Configuration

Before compiling consider modification of STA_SSID1 and STA_PASS1 values inside of user_config.h to match your WiFi SSID and WiFi password.

#define STA_SSID1              "indebuurt1"      // [Ssid1] Wifi SSID 
#define STA_PASS1              "VnsqrtnrsddbrN"  // [Password1] Wifi password 

This operation simplifies further first steps, as Sonoff will automatically recognize and join your WiFi.

Setting the DST/Standard Time rules in user_config.h will also simplify future configuration

#define TIME_DST  North, Last, Sun, Mar, 2, +120  // Northern Hemisphere, Last sunday in march at 02:00 +120 minutes
#define TIME_STD  North, Last, Sun, Oct, 3, +60  // Northern Hemisphere, Last sunday in october 03:00 +60 minutes

Do not be tempted to use other board types within the Arduino IDE (e.g. if programming Wemos etc.) if you want to use Tasmota's OTA updating, as this can cause failure and require serial port reprogramming. Always use the Generic ESP board as stated above.

If your new configuration does not seem to be applied after flashing then you can do any of the following to fix it:

  • Change the CFG_HOLDER value in user_config.h and re-flash
  • Hold down the button on your device for at least 4 seconds to initiate a RESET command
  • Reset the device via the Web Console


Check the Troubleshooting page if got problems while flashing.

Theo's Tasmota Tips
What's New

Getting Started

Upload tools


Devices - Additional Info

Home Automation Integration

Other Integrations

Further Topics



Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.