Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
- Download the latest Sonoff-Tasmota "Source code (zip)" and extract it - you may also git clone the repository
- Load the Sonoff-Tasmota base folder in PlatformIO
- Connect the Sonoff module in Flash Mode (see Hardware Preparation section and device specific articles)
- Select a firmware variant to flash onto your module by uncommenting one of the
env_defaultlines in platformio.ini, see below for variant details. You may also need to change the
upload_portto match the communications port of the USB serial interface.
user_config.hand configure your WiFi settings and optionally your MQTT, Syslog, WebServer, NTP, etc. settings
- Select "Upload" from the menu to flash the firmware
- After successful transfer of the firmware disconnect the module
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.
See the upload section from Arduino IDE in the right hand menu.
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: https://github.com/mirko/SonOTA
Before compiling consider modification of
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.