Tasmota: Build your own tasmota firmware

Hi,

if you want to use Conditional Rules in tasmota you have to built your own firmware, because Conditional Rules are not included in the precomplied binaries.


But its quite simply if you have a linux computer 🙂

Install required python packages

michael@debdev ~ # sudo apt install python3 python3-venv

Create a virtual env in your home directory for separating your python packages from the system packages

michael@debdev ~ # python3 -m venv tasmota-build
michael@debdev ~ # source tasmota-build/bin/activate
(tasmota-build) michael@debdev ~ # pip install --upgrade pip
(tasmota-build) michael@debdev ~ # pip install -U platformio
(tasmota-build) michael@debdev ~ # git clone https://github.com/arendst/Tasmota.git Tasmota

Get sources

(tasmota-build) michael@debdev ~ # git clone https://github.com/arendst/Tasmota.git Tasmota
(tasmota-build) michael@debdev ~ # cd Tasmota
(tasmota-build) michael@debdev ~/Tasmota #

Now you have to adjust plotformio.ini and tasmota/my_user_config.h.

In platformio.ini comment out your target

[build_envs]
default_envs =
; *** Uncomment by deleting ";" in the line(s) below to select version(s)
; tasmota
; tasmota-ircustom
; tasmota-minimal
; tasmota-lite
; tasmota-knx
; tasmota-sensors
; tasmota-display
; tasmota-zbbridge
; tasmota-ir
; tasmota-BG
; tasmota-BR
; tasmota-CN
; tasmota-CZ
tasmota-DE

in tasmota/my_user_config.h comment rules and comment out USE_EXPRESSION and SUPPORT_IF_STATEMENT

// -- Rules or Script ----------------------------
// -- Rules or Script ----------------------------
// Select none or only one of the below defines USE_RULES or USE_SCRIPT
#define USE_RULES // Add support for rules (+8k code)
#define USE_EXPRESSION // Add support for expression evaluation in rules (+3k2 code, +64 bytes mem)
#define SUPPORT_IF_STATEMENT // Add support for IF statement in rules (+4k2 code, -332 bytes mem)


Or add them to tasmota/user_config_overwrite.h. Note: If you want to overwrite some values from my_user_config.h use an #undef statement before #define:

#undef NTP_SERVER1
#define NTP_SERVER1 "myNtp.server.org"

Then build the firmware, new firmware is saved in ./build_output/firmware

(tasmota-build) michael@debdev ~/Tasmota # pio run

(tasmota-build) michael@debdev ~/Tasmota # ls -l ./build_output/firmware/tasmota-DE.bin
-rw-rw-r-- 1 michael michael 630448 Nov  8 10:12 ./build_output/firmware/tasmota-DE.bin

If you want to run a clean build run

(tasmota-build) michael@debdev ~/Tasmota # pio run -t clean

first. Prune some old data

(tasmota-build) michael@debdev ~/Tasmota # pio system prune

Michael

One thought on “Tasmota: Build your own tasmota firmware”

Leave a Reply Cancel reply