HowTo: Tasmota – firmware flashing

Besides the hardware, the right software for your project is just as important. A practical and universally applicable firmware for the “forest-and-meadow microcontroller” ESP8266 is the Tasmota firmware. This allows you to realize various projects without having to program yourself. Besides, you do not have to “reinvent” the wheel every time. 🙂

Before you can use this with your microcontroller, it must first be transferred to this. How to do it and what you have to pay attention to is described in the following article.

Hints for our lovely english readers: Basically, many of the articles on are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂

Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance.

Affiliate links / advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support in being able to offer further useful projects in the future. 🙂


Helpful Articles:
Before you start with this article, you should have the Arduino IDE installed and configured. Information on this can be found in the following article.
Install programs – an example
ArduinoIDE – Tips and Tricks

Required material:

In the following list you will find all the parts you need to implement this article.

Required tools:

In the following list you will find all the tools you need to implement this article.

Copy the current Tasmota version from the GitHub

Before you can start configuring and programming the Tasmota firmware, you must first download it from the GitHub.

The files for the firmware can be found at:

How to download files from a GitHub is in the article GitHub – How to copy files from a GitHub to my computer.

After downloading the compressed firmware files you have to unpack them. Tips can be found in the article WinRar? WinZip? WinWas? – Darling I shrunk the files

Configure the Tasmota firmware

Many settings of the Tasmota firmware can also be set during operation. Nevertheless, I find it easier to import these settings directly through a correctly configured firmware.
In addition, this is absolutely necessary with some of the sensors used, since not all software components for each sensor or actuator are compiled by default (“added to the firmware”).

In the now downloaded GitHub project you will find some folders. For us, only the folder “lib” and “sonoff” is important. “Lib” contains all the Arduino libraries that Tasmota needs to be successfully compiled. So install all the contained Arduino libraries. Hints can be found in the article ArduinoIDE – Installing a library If you have done this you can switch to the folder “sonoff”.
This contains all required firmware files. Now open it by double-clicking on the file “sonoff” or “sonoff.ino”.
This will open the complete Tasmota project in the Arduino IDE.
Change as shown in the tab “user_config.h”. As this name suggests, you can configure all options of the Tasmota firmware here. This is divided into different “subject areas”.

The different options of the Tasmota firmware

In the now open “user_config.h” all kinds of settings are available. Most of the time you only need a fraction of it. For the sake of completeness, all options are listed here and briefly described.

So that you do not have to go through each option individually, I marked the options that you must necessarily edit green. For example, passwords or URLs that you absolutely have to configure individually or at least check. Check these options before transferring the firmware to your Tasmota device.

“PROJECT” specifies the name of your project. This is also the ID which is used as a prefix for the MQTT path used by this ESP.
“MODULE” determines which hardware this Tasmota firmware will be installed on. So you can now specify whether this configuration for a Sonoff S26 or a simple WEMOS D1 mini module is used.
“SAVE_DATA” enables or disables storing changed settings in flash memory. You should leave this activated, otherwise your settings will be lost after each restart or power interruption.
“SAVE_STATE” activates or deactivates that the last switching state remains stored in the flash memory. For example, if you use the Tasmota firmware to drive a lamp, you can ensure that it will recover even after a power failure.
Here you can configure the used IP address, gateway, subnet mask and the IP of the DNS server. However, in most networks this is not necessary because this data is dynamically negotiated with the router. The default values can be left in most cases.
Now we come to an important part that you should at least check before playing the firmware. Because here are the login data configured to your WiFi. Here you can add your WiFi-ssid(name of your WiFi) at “STA_SSID1”  and specify under “STA_PASS1” the password of the WiFi. Under “STA_SSID2” and “STA_PASS2” it is possible to configure another WiFi. This is used if a connection to the first configured WiFi failed. “WIFI_CONFIG_TOOL” “WIFI_CONFIG _…
In the section “Syslog” you can configure server data for a syslog server. This is not necessary for most users. Syslog is a system for monitoring log messages of individual clients in a network. This requires a syslog server. In addition to the syslog data, you can also configure the log messages that are output via the serial console or the web console. This will allow you to adjust how detailed the output on the web or serial console is. The following levels are possible (which are getting more and more detailed in this order): LOG_LEVEL_NONE, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_DEBUG, LOG_LEVEL_DEBUG_MORE
With “OTA_URL” you can specify a URL from the OTA (Over-the-Air) updates. If you start an update later in the already installed Tasmota firmware, Tasmota will search for it at the specified address and install it, if necessary.

In the “MQTT” section you can set the basic parameters for connecting to the MQTT server.
– “MQTT_USE” activates the MQTT client.
– “MQTT_HOST” sets the address of your MQTT server.
– Under “MQTT_FINGERPRINTX” you can define the fingerprint for encrypting your MQTT connection.
– “MQTT_PORT” sets the port of your MQTT server.
– In “MQTT_USER” and “MQTT_PASS” you can specify username and password for your MQTT server.
– With “MQTT_BUTTON_RETAIN”, “MQTT_POWER_RETAIN” and “MQTT_SWITCH_RETAIN” you can activate the retain flag for the respective MQTT messages. This causes the respective MQTT messages to also be sent to MQTT clients that were not yet online at the time of sending the MQTT message.
– With “MQTT_STATUS_OFF” you can set the string used in commands to turn off something.
– With “MQTT_STATUS_ON” you can set the string used in commands to turn something on.
– With “MQTT_CMND_TOGGLE” you can set the string used in commands to switch something.
– With “MQTT_CMND_HOLD” you can set the string to be sent if a button is pressed for longer than specified in KEY_HOLD_TIME.

In these sections, various details about the MQTT topics used can be determined.
With “MQTT_FULLOPIC” you determine the structure of the used Topics. By default, this always consists of the “prefix” and the respective “topic”.

The prefixes are then defined under “SUB_PREFIX”, “PUB_PREFIX” and “PUB_PREFIX2”.
Your Tasmota device uses the prefix specified under “SUB_PREFIX” as a subscription – in other words, to receive values ​​and commands.
The prefix specified under “PUB_PREFIX” is used to publish values.
Telemetry data is sent via the prefix specified in “PUB_PREFIX2”.

Under “MQTT_TOPIC”, “MQTT_GRTOPIC”, “MQTT_BUTTON_TOPIC”, “MQTT_SWITCH_TOPIC” the topics will be defined.
“MQTT_TOPIC” stands for the individual topic of the Tasmota device. In the process, part of the MAC address of your Tasmota device is always attached.
“MQTT_GRTOPIC” stands for a topic in which you can group together several Tasmota devices.
With “MQTT_BUTTON_TOPIC” and “MQTT_SWITCH_TOPIC” you can set special topics for any connected buttons and switches.

With “MQTT_CLIENT_ID” you can still specify the name or the ID of the MQTT client.

You can usually leave all these values ​​like that.

“TELE_PERIOD” defines the interval at which the telemetry data is sent. This time is given in seconds. With a value of 300, the telemetry data such as connection data and sensor values are sent to the set MQTT topics every five minutes.
With “DOMOTICZ_UPDATE_TIMER” you can specify in which interval the relay status will be sent or updated to your Domoticz instance.
You can use the parameter “HOME_ASSISTENT_DISCOVERY_ENABLE” to activate the automatic detection of your Tasmota device. In case you use home-assistants then this function should be activated.
Various settings for the web server running on the Tasmota device can be configured in this area. “WEB_SERVER” determines in which user mode the web server is running. If you have set this to “2” = Admin you should definitely set a password for the next option “WEB_PASSWORD”. Otherwise, anyone with access to your network will be able to change and control the configuration of your Tasmota device. With “FRIENDLY_NAME” you can then define a more legible name. This will be used to display in the web menu and for the eventual link with Alexa.
With the option “NTP_SERVERX” you can specify the address of the NTP server. You can specify three different servers. If the first server is unreachable, the next configured one is automatically used as a replacement.

With these and the options in the next section you can set the criteria for the summer/winter time changeover. The parameters that start with “TIME_DST …” specify under which conditions the standard time (winter time) is changed to summer time. The parameters that start with “TIME_STD _…”, on the other hand, are decisive for the opposite case, ie the changeover from summer to winter time. The parameters are otherwise identical for both areas: “… HEMISPHERE” determines which part of the globe you are on. This option is not actually needed for the time change but rather for the calculation of the correct sunrise and sunset time.

Now it goes to the parameters for the time change. Since the time change (at least in Germany) from winter to summer time always takes place on the last Sunday of March at 02:00 o’clock you have the parameter “TIME_DST_WEEK” on “Last”, the parameter “TIME_DST_DAY” on “Sun” (= Sunday) , set the parameter “TIME_DST_MONTH” to “Mar” (= March) and the parameter “TIME_DST_HOUR” to two. With the parameter “TIME_DST_OFFSET” you set at which time difference the time changeover occurs. You also have to indicate the deviation through the time zone. In the case of Germany, that has the time zone UTC+1, +60 minutes, here applies for the summer time +120 minutes.

The time change from summer to winter time (again in Germany) always takes place on the last Sunday in October at 03:00 o’clock.
Therefore you have to set the parameter “TIME_STD_WEEK” to “Last”, the parameter “TIME_STD_DAY” to “Sun” (= Sunday), the parameter “TIME_STD_MONTH” to “Oct” (= October) and the parameter “TIME_STD_HOUR” to three. With the parameter “TIME_STD_OFFSET” you then give which time difference occurs in this case. You also have to indicate the deviation through the time zone. In the case of Germany, that has the time zone UTC+1=+60 minutes, then applies here for the standard time (= winter time) +60 minutes.

With the options “LATITUDE” and “LONGITUDE” you can set the position of the Tasmota device. This is necessary to calculate the correct sunrise and sunset time. If you want to use this function, it is important to enter the correct data here. How to find out the location of any location is described in the article Determining latitude and longitude of any position using Google Maps. Make sure that you indicate the position (as shown) in the decimal system. How to do this is also described in the mentioned article.

“APP_TIMEZONE” defines the time zone.
“APP_LEDSTATE” defines the function of the integrated LEDs (in many Sonoff devices)
“APP_PULSETIME” defines the pulse duration in the form of multiples of 0.1 seconds. A value of 5 corresponds to 0.5 seconds or 500 milliseconds. A value of 0 deactivates this function.
“APP_POWERON_STATE” defines the state of the configured relays after power up. The following settings are available: POWER_ALL_OFF, POWER_ALL_ON, POWER_ALL_SAVED_TOGGLE, POWER_ALL_SAVED, POWER_ALL_ALWAYS_ON, POWER_ALL_OFF_PULSETIME_ON
“APP_BLINKTIME” defines the pulse length of a “flashing” relay
“APP_SLEEP” defines a time between 1 and 250 milliseconds in which the ESP8266 is put into sleep mode. This way, you can save some energy. Of course, the ESP8266 reacts in the worst case only 250 milliseconds later.
“KEY_DEBOUNCE_TIME” defines the debounce time of a connected probe. A value of 50 indicates that after a key has been detected, the button in question will be ignored for 50 milliseconds.
“KEY_HOLD_TIME” defines the length of time a button must be pressed until it is recognized as a permanently pressed button. The specified value is again multiplied by 0.1 seconds. A value of 40 corresponds to a duration of 4 seconds. So after 4 seconds, the “button is pressed”-event is triggered.
“SWITCH_DEBOUNCE_TIME” defines the debounce time of a connected switch. A value of 50 thus indicates that after a detected switch position change the relevant switch is ignored for 50 milliseconds.
“SWITCH_MODE” defines the behavior of the configured relay with respect to a connected switch. The following options are possible:
“WS2812_LEDS” defines the number of connected WS2812 LEDs.
“TEMP_CONVERSION” activates (= 1) or deactivates (= 0) the conversion of the temperature to the unit Fahrenheit.
“TEMP_RESOLUTION” defines the resolution with which the temperature is displayed. You can choose between no and up to three digits after the comma. ATTENTION: The respective resolution must of course also be supplied by the connected sensor. Otherwise, this supposedly more exact value is guessed rather than exact.
“HUMIDITY_RESOLUTION” defines the resolution with which the humidity is displayed. You can choose between no and up to three digits after the comma. ATTENTION: The respective resolution must of course also be supplied by the connected sensor. Otherwise, this supposedly more exact value is guessed rather than exact.
“PRESSURE_RESOLUTION” defines the resolution with which the air pressure is displayed. You can choose between no and up to three digits after the comma. ATTENTION: The respective resolution must of course also be supplied by the connected sensor. Otherwise, this supposedly more exact value is guessed rather than exact.
“ENERGY_RESOLUTION” defines the resolution with which the energy consumption is displayed. You can choose between no and up to five digits behind the comma. ATTENTION: The respective resolution must of course also be supplied by the connected sensor. Otherwise, this supposedly more exact value is guessed rather than exact.

In this area you can specify the language used by the Tasmota device, e.g. for the web menu. To activate the respective language, the // must be removed before the corresponding line. All other lines should then be deactivated by a preceding //. In the example shown above, German (DE-DE) is currently defined as the language.

With these options, the behavior in the case that for the Tasmota device no valid wireless LAN access data are stored. If “USE_WPS” is activated (ie the two // removed before the corresponding entry) you have the possibility to connect your Tasmota device to your router via the WPS function. If “USE_SMARTCONFIG” is activated you can configure the access data with the Android app ESP8266 Smart Config.

With the parameter “USE_ARDUINO_OTA” you activate the OTA function. So it is possible to get “Over the Air (= OTA)” updates on the Tasmota device. The big advantage of this is that you can install the firmware over the Wi-Fi connection to the Tasmota device without having to connect it with a USB cable. If you have the memory available I recommend to keep this function activated.
In this area you can specify the used MQTT library. Activates or deactivates the desired option by removing or adding the prefixed //. Normally you can leave the option “MQTT_PUBSUBCLIENT” activated.
“MQTT_TELE_RETAIN” activates or deactivates the retain flag for the transmitted telemetry data. This means that if another MQTT client subscribes to the respective telemetry topic after values have been sent to it, these values will be delivered again to the newly connected MQTT client.
With “DOMITICZ_IN_TOPIC” you can set the Domiticz input topic. With “DOMITICZ_OUT_TOPIC” you can set the Domiticz output topic.
With “USE_HOME_ASSISTENT” you can activate the automatic “notice” of your Tasmota device. The option “HOME_ASSISTENT_DISCOVERY_PREFIX” can then be used to set the desired prefix.
The USE_MQTT_TLS option enables or disables TLS encryption for your MQTT communication. This is a big gain in security but unfortunately also at the expense of the used memory. So you can not use this function depending on memory usage in every configuration.
With “USE_KNX” you can activate or deactivate the support for the KNX protocol. In addition, “USE_KNX_WEB_MENU” can be used to enable or disable the associated web menu.
In this section you can set the essential settings for your web server. With the option “USE_WEBSERVER” the complete web server functionality can be activated or deactivated. “WEB-PORT” defines the used port and “WEB_USERNAME” the desired user name. With the option “USE_EMULATION” you can simulate the simulation of a Belink WeMo incl. Hue Bridge. This will enable you to control the device via the SmartHome function of your Alexa device.
With “USE_DISCOVERY” and the corresponding subcategories, you activate the function that your Tasmota-device independently searches for the hostname of your MQTT server or the web server can be reached via a local domain name. For this, the corresponding options “WEBSERVER_ADVERTISE” or “MQTT_HOST_DISCOVERY” must be activated.
With “USE_TIMERS” and the following options you can activate/deactivate and control the timer functions of Tasmota. You can activate/deactivate with “USE_TIMERS_WEB” that the timers can be controlled/displayed via the web interface. With “USE_SUNRISE” you can add various functions that allow you to react to sunrise and sunset times. In order to be able to define these times precisely, you can also specify exactly which dusk should be used with “SUNRISE_DAWN_ANGLE”. There are the following options: DAWN_NORMAL, DAWN_CIVIL, DAWN_NAUTIC, DAWN_ASTRONOMIC
USE_RULES enables/disables support for custom rules. So if you want to control your Tasmota device individually with certain rules, you should activate this function.
The option “USE_ADC_VCC” is important in case you want to use the integrated ADC of your ESP8266. If this option is activated, the internal ADC will be used to measure the supply voltage. In this case it is not possible to measure external voltages. For this purpose, this function must be disabled.
With “USE_DS18x20” you can enable or disable support for DS18x20 temperature sensors. With “W1_PARASITE_POWER” you can additionally improve the support for the parasitic energy supply.
In this category the support for various sensors connected via the I2C protocol can be activated/deactivated. In each case, the option “USE_I2C” must be activated. The individual support for the respective sensors is then configured by activating/deactivating the respective option.
The option “USE_SPI” enables/disables the support for sensors and actuators communicating via SPI.
In addition to I2C and SPI, sensors and actuators with a serial interface can also be connected. In this section you can activate/deactivate the support for the respective sensors.
With the Tasmota firmware it is also possible to send and receive infrared commands. The necessary settings can be found in this section. The function “USE_IR_REMOTE” activates/deactivates the possibility to send commands. The function “USE_IR_RECEIVE” on the other hand activates/deactivates the function to receive commands.
You should enable the “USE_WS2812” option if you want to use your Tasmota device to control WS2812 LEDs. You can also use “USE_WS2812_CTYPE” to change the LED type, eg. NEO_GRB/NEO_RGB/etc. to adjust. The option “USE_WS2812_DMA” allows you to control the WS2812-LEDs via the DMA interface. This makes sense especially for time-critical ads and reduces the processor load.
The USE_ARILUX_RF option enables/disables support for the Arilux RF controller.
Use the USE_SR04 option to enable/disable support for the very popular HC-SR04 Ultrasonic Distance Sensor.

The “USE_RF_FLASH” option, if activated on a SONOFF 433Mhz RF Bridge, enables programming of the connected co-processor via the web interface of the Tasmota firmware. Further details can be found in the article Tasmota – Sonoff RF Bridge RF-Chip (EFM8BB1) with Portisch Firmware flashing.

In this and the following section you can configure options that are mainly useful for developers. The USE_DEBUG_DRIVER option enables/disables experimental drivers for not yet fully tested sensors and actuators.
These options enable/disable certain “default configurations”. “USE_CLASSIC” activates all options necessary for the “classic” Tasmota version. “USE_SESNORS” enables all options for the most used sensors. “USE_KNX_NO_EMULATION” creates a version with KNX but without emulating this function. “BE_MINIMAL” deactivates most of the functions and thus creates a very compact firmware image, which is perfectly suited to be installed via OTA on an ESP8266.

Start the programming process

After you have adjusted or configured the firmware according to your wishes, it is now time to transfer them to the ESP8266 of your Tasmota device. This example programs a standard ESP8266 adapter board of the WEMOS D1-Mini with the Tasmota firmware.

First, select the ESP8266 adapter board you are using.
In the case of a WEMOS D1-Mini, the options should be set as shown. With the option “Erase Flash …” you can still set which data should be deleted during programming. You can choose between “Only Sketch” = Only the firmware, “Sketch + Wifi Settings” = Firmware and Wifi configuration data and “All Flash Contents” = All data. Normally, you can leave this set to “Only Sketch”.
To start the programming process, click on the turquoise green arrow symbol (the second one on the left) in the upper icon bar.
This starts the compilation and subsequent programming of the firmware. Depending on the size of the firmware, this process can take one to five minutes. If successful, it will be confirmed by a “complete upload” in the lower status bar.
You can also check the starting process of the newly programmed ESP8266 via the serial interface. After the successful installation, the Tasmota firmware outputs all kinds of status messages. Click on the menu item “Tools” and “Serial Monitor”. You can also find more information about the serial interface in the article Ardunio – Using the serial interface.
In the now opened window you can read all messages of the ESP8266 or the Tasmota firmware that are output during the boot and connection process.

Have fun with the project

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at   


  1. in der aktuellen tasmota Firmwareversion von github gibt es den Ordner sonoff so wie oben beschrieben nicht mehr. Das Kompilieren funktioniert nicht. Was mache ich falsch?
    Schöne Grüße

Leave a Reply

Your email address will not be published. Required fields are marked *