Compiling Tasmota on Gitpod - FengtianGu/Sonoff-Tasmota GitHub Wiki

Even though Tasmota offers several pre-compiled firmware variants, sometimes the ready-to-flash binaries aren't enough. Do you want to enable or disable some features, or simply change some parameters? Then you need to compile a binary yourself.

If you are not experienced enough or don't want to install an IDE (Integrated Development Environment) like PlatformIO or Arduino-IDE on your computer, you can compile your own firmware in a breeze on Gitpod.

Gitpod:

Gitpod is a web browser based online IDE. All you need to use it is to link your GitHub account (or make a new one here).

Gitpod login

After you successfully sign in, you can start your personal project. The fastest way to load Tasmota into Gitpod is with one of the following links:

Gitpod will take care of all the necessary software package dependencies for you.

After loading the project, you will be greeted by the main window, presenting three panels:

  1. Explorer
  2. Editor
  3. Terminal

Gitpod main screen

Explorer is the first place you need to look to edit your configuration.

:warning: ATTENTION:

The proper method of customizing firmware compilation options is to use the user_config_override.h file. Most customizations should not require changes to the my_user_config.h file. To modify the stock configuration:

  1. Select the /sonoff folder in the Explorer (1) pane
  2. Create a new file called user_config_override.h
  3. In the Editor (2) pane, change, add, or remove anything you need in your configuration file to define your own settings. Refer to the user_config_override_sample.h file as well as my_user_config.h for #define options. You can find a list of Tasmota features supported listed here. Define the features you require in your configuration file.
  4. Open the platformio.ini file located in the /Sonoff-Tasmota root directory (scroll to the bottom of the file Explorer pane)
  5. In the Editor (2) pane, find the [common] section and uncomment (remove the semicolon ; at the beginning of the line) -DUSE_CONFIG_OVERRIDE

Edit platformio.ini

When you are done, save all of your edits (user_config_override & platformio.ini). Now you're ready to compile.

COMPILING YOUR BINARY:

This action is done in the Terminal pane (3) with very simple commands. The simplest one is platformio run -e sonoff

compile command

With this command, Gitpod will compile the Tasmota firmware with the features you selected. If you need a different variant, you can specify this option on the command line:

platformio run -e <variant-name>

For example: platformio run -e sonoff-sensors or platformio run -e sonoff-DE

Compilation normally takes only a couple of minutes. The time if takes is directly related to the configurations you selected; the more features selected means more time is needed to compile. When done, you will find you binary (firmware.bin) in /Sonoff-Tasmota/.pioenvs/<variant-name>/

folders

Download the firmware.bin file to your computer and you are now ready to flash your device. Use esptool or any other firmware upload method.

Watch a livestream video by digiblurDIY of compiling Tasmota using Gitpod.

Browser Extension:

Gitpod has a browser extension (Chrome and Firefox) useful to directly load a GitHub project into your personal work-space.

Gitpod link

More information here.