Posted on 10 Comments

#37: Installing Tasmota using Tasmotizer

Installing Tasmota onto a device such as a Sonoff is usually done using esptool.py, which is a powerful command line utility but it can be a bit confusing if you’re not used to it. Now it’s been paired with an amazing graphical interface called Tasmotizer that gives you point-and-click convenience, and adds some handy features for configuring your devices:

Resources

Install Tasmotizer

The Tasmotizer page has good installation instructions, with three options given.

  1. If you use Windows, download the executible and run it.
  2. On Linux or MacOS, you can install using Pip.
  3. If you want the absolute latest development version you can clone the Git repo and install manually.

Use whichever method suits you best. I used Pip to install it on my iMac, my Macbook Pro, and my Ubuntu desktop, and the process went smoothly on all of them. Make sure you have the latest version of Pip, and then use it to install Tasmotizer:

pip3 install --upgrade pip
pip3 install tasmotizer

Launch Tasmotizer

If your Python installation is set up so that new programs are automatically available, it should be possible to simply type in the name and press “Enter”:

tasmotizer.py

However, you may not be so lucky. You may have to find where Pip installed it. Pip can tell you where the files are for a specific package, but its output has horrible formatting that’s hard to interpret. Run this command to see a list of all the files in the Tasmotizer package:

pip3 show -f tasmotizer

The output will include a line called “Location” which shows the directory where the program is located. On my iMac, Pip installed Tasmotizer at:

~/Library/Python/3.7/bin/tasmotizer.py

But on my Macbook, it was installed at:

/usr/local/bin/tasmotizer.py

And on my Ubuntu desktop, it was installed at:

~/.local/lib/python3.7/site-packages/tasmotizer.py

It’s a pity that Python’s installation management is such a mess, and produces unpredictable results. Hopefully you can find the location for your installation without too many problems.

Once you’ve discovered its location, paste in the appropriate command and press “Enter” to launch Tasmotizer.

Connect the device to your computer

Your target device needs to be connected to your computer using USB, either by directly plugging in a cable or by using a USB-to-Serial adapter. Some devices such as Wemos D1 Mini boards have built-in USB. Sonoff boards don’t have USB so you’ll need to make up an adapter to suit the programming header for your specific board. I’ve done many videos and guides for reflashing various Sonoff models, and the Tasmota site has excellent documentation so follow the appropriate guide to make the connections.

Most Sonoff models use a simple 4-pin header, so I designed the Sonoff Programming Adapter to make it easy to plug in a 3.3V USB-to-Serial adapter with a standard 6-pin header.

Place device into bootloader mode

The ESP8266 / ESP8285 processor needs to be placed into a special bootloader mode before it can have Tasmota installed. This is done by powering it up while the GPIO0 pin is held at 0V, which is usually done using the control button. The sequence is:

  1. Press and hold the button.
  2. Connect power.
  3. Wait a couple of seconds, then release the button.

The device then stays in bootloader mode, waiting for new software to be loaded.

Select device in Tasmotizer

Click the “Refresh” button so Tasmotizer will scan for connected devices and update its list. Use the drop-down to find your target device.

Select the firmware image

Tasmotizer gives you three options for selecting a firmware image.

If you have your own binary, such as a version of Tasmota or some other firmware that you’ve compiled or downloaded, click the “BIN file” radio button and select the file from your local disk.

If you want to install the current release version of Tasmota, click the “Release” radio button and then use the drop-down menu to select the specific flavour of Tasmota for your device.

If you like to live on the edge, you can click the “Development” radio button and use the latest development code that hasn’t been released yet.

Set flashing options

If you want Tasmotizer to make a backup of the existing software on your device, click the “Backup original firmware” option. This will allow you to put it back onto the device later if you change your mind.

If you want to make sure the entire memory of the device is cleared, click the “Erase before flashing” option. This makes sure there is nothing remaining from the previous firmware still left on the device, such as saved configuration options. This is a good idea to make sure you have a fresh start and Tasmota won’t read data from a previous installation.

Flash the firmware

With the correct firmware image selected, click the blue “Tasmotize!” button. Tasmotizer will download the selected image (if required) and install it onto your device.

You’ll see a progress bar as the image is installed. Once it’s done, you’ll be prompted to restart it.

Congratulations! Tasmota is installed.

If you want to configure it manually you can do that by following the usual Tasmota instructions. However, Tasmotizer can save you a lot of time by allowing you to do some basic configuration via USB while it’s still connected to your computer.

Select config options

Click the “Send config” button to open a configuration window.

WiFi setup

Click the check-box to enable the WiFi section, and enter your WiFi network name and password.

Module/template setup

Click the check-box to enable module/template setup, which gives you options to either select a pre-defined module or apply a template. Applying a module profile or a template allows your device to be configured entirely from Tasmotizer.

If you have a common device, select “Module” and find the device in the drop-down list.

If you have a device that has a template provided for it, select “Template” and then paste the template into the text box. There are more than 1000 templates provided at the Tasmota Device Templates Repository.

MQTT setup

If you use MQTT in your home automation system, click the check-box to enable MQTT setup and put in the address of your MQTT broker.

You can manually define the topic for this device (such as “bedroom1”) but my personal preference is to allow the device to generate the topic based on its own internal ID. That way all devices come up with their own unique topics, which can then be referenced in the home automation system.

To do that, change the “Topic” setting to add the extension “-%06X”, like this:

tasmota-%06X

What this will do is take the last 6 hexadecimal digits of the device ID and append them, so the topic will be something like “tasmota-6A0B15”. This value is then used to generate the FullTopic value below it automatically, by replacing the “%topic%” placeholder. The result will be full topics that look similar to:

cmnd/tasmota-6A0B15/POWER
tele/tasmota-6A0B15/TEMPERATURE
...etc

I like this approach because it means that all my Tasmota devices can have the same configuration, but they still end up with unique MQTT topics.

Send config to device

With all your preferred options set, click the “Save” button. Tasmotizer will send your configuration to the device, and you’re all done. This step is a bit strange, because it happens so fast that it seems like it couldn’t possibly have done anything, but if you get a confirmation dialog then you’re all set.

Finished! Your Tasmota device will now reboot and apply the settings that you configured, so after a few seconds it will be on your network. Just follow the Tasmota documentation to learn how to link it to your home automation system.

10 thoughts on “#37: Installing Tasmota using Tasmotizer

  1. Hi, wondering if you can help me. I am on a mac (10.15.4), i’ve installed tasmotizer via pip3, but I am unable to get the gui to run. I’m getting permission denied. I ran a chmod to 744 on tasmotizer.py. I now get this error message on the terminal:
    Traceback (most recent call last):
    File “./tasmotizer.py”, line 7, in
    import tasmotizer_esptool as esptool
    File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/tasmotizer_esptool.py”, line 36, in
    from PyQt5.QtCore import pyqtSignal, QObject, pyqtSlot
    ImportError: No module named QtCore

    When I run the install, I noticed this message:
    Installing collected packages: PyQt5-sip, PyQt5, tasmotizer
    WARNING: The scripts pylupdate5, pyrcc5 and pyuic5 are installed in ‘/Library/Frameworks/Python.framework/Versions/3.7/bin’ which is not on PATH.
    Consider adding this directory to PATH or, if you prefer to suppress this warning, use –no-warn-script-location.
    Successfully installed PyQt5-5.14.2 PyQt5-sip-12.7.2 tasmotizer-1.1.1

    Is there anything I should be looking at?

  2. Re my previous message. I got the GUI running by running

    PATH=$PATH:/Library/Frameworks/Python.framework/Versions/3.7/bin
    export $PATH
    then => echo $PATH

  3. I’ve previously used esptool but Tasmotizer is definitely the way to go.

    It is a few months since I successfully setup my first 2 Sonoff Basic devices following your earlier tutorial which was also extremely well done.

    I had timeout problems using esptool.py before and solved that by setting up a Raspberry Pi 3B+ just to use esptools.py.

    I had bought another 10 Sonoff switches and today set out to configure 2 more. I watched the Tasmotizer tutorial a few weeks ago but as it is based on esptools.py and I had had timeout issues before I stuck with that until one last I used Tasmotizer but it failed for the same reason.

    I had blown away the Pi but started afresh when my Linux Mint desktop had the same timeout issues as before. Unfortunately using the Pi didn’t help this time.
    This is what I get on my desktop. The problem is the same on the Pi and Linux notebook.

    john@hipster ~ $ sudo esptool.py -p /dev/ttyACM0 write_flash -fs 1MB -fm dout 0X0 /home/john/Downloads/tasmota_8.2.bin
    esptool.py v2.8
    Serial port /dev/ttyACM0
    Connecting…….._____….._____….._____….._____….._____….._____….._____

    A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header
    john@hipster ~ $

    I have 2 Freetronics USB to serial devices and have been working with 2 Sonoff Basic switches straight out of their boxes. The green LED of the switch blinks when connection is done without pressing the black button. The USB serial device RX LED flashes a few times when the connection is done with the Sonoff button pressed and the green LED does not blink. Only the RX LED flashes when esptool.py is run.

    I’m not using your 6 pin to 4 pin connector but my wiring is based on it.

    I gather many other people have the same problem but I haven’t seen any post on how to fix it.

    Do you have any suggestions on what to try next?

  4. Yesterday I reported been blocked using the underlying esptool.py to put Tasmota on a Sonoff Basic.

    Today I pulled out my Windows notebook and installed Python, esptool and Tasmotizer. I didn’t change the setup of the USB to serial adapter and Sonoff and started with esptool.py. No problems. I then used Tasmotizer. It really does work well.

  5. Back again. I’ve just re-flashed a second Sonoff Basic on my Windows notebook. I ran into the timeout problem again. I got around it this time by using a different USB port.

    Using a second USB port I tried saving the existing firmware but that raised an error indicating an issue with the parameters Tasmotizer sends. I then had timeouts again. I succeeded re-flashing without backing up the existing firmware by using a third USB port.

    Hopefully my experience will help others who run into fragility with the USB connection. The end result is very worthwhile.

    The tasmota.bin file I used is version 8.2 and generates the host name a bit differently so the approach of using the last 6 characters of the device no longer works as expected. My preference is to set the topic based on the device purpose (eg tasmota-inverter) anyway. It turns out that this also impacts on the host name generated (eg tasmota-inverter-1866).

  6. I have a similar problem to John in that I get various timeout errors (not all the same). Being persistent I tried Tasmotizing over 50 times, and in all those attempts I suceeded only twice. But having loaded Tasmota I cannot the access the device, as Tasmota doesn’t tell me the IP name. So I tried the manual method and found the IP name was Tasmota-09D517-5399, which isn’t like Sonoff-D517 that I was expecting. I eventually went back to the eWelink software via Tasmotizer, but it although flashed OK I still cannot use it. I checked my USB voltage and it was 3.125V, and I even tried powering up at the end without RX & TX, as some one else suggested but no luck. Question: Why is the comms so difficult? Are there timing issues or have I got a dodgy Sonoff? I’ve spent over two weeks on this, mostly frustration but some joy on the two occasions it actually worked.

    1. Update. I have tried another 30 or so times with another Sonoff basic but no joy at all. Same set of errors as mentioned above. I have given up entirely and gone back to Ewelink which seems a lot easier to set up than before. Sad, I even bought flash memory chips in order to up the capacity as was suggested.

    2. I don’t know why I had problems flashing the Sonoff switches but once I used a machine where the communications problem did not occur. I ended up putting Tasmotizer on 10 Sonoff switches.

      I appreciate your frustration but it is worth trying different machines until you succeed. Once Tasmotizer is installed you won’t have problems.

      Unlike Jon, I name the Sonoff switches according to purpose and that works well.

      In practice you need to set static IP addresses at your router using the MAC address of the switch if you want to do maintenance. I ‘m using Home Assistant and am using TasmoAdmin and quickly found that dynamic IP addresses was an issue. The switches work regardless as the IP address is irrelevant to MQTT (except for the broker IP).

      I have 8 Tasmo/Sonoff switches and they have been working reliably over many weeks now. There are the odd dropouts in WiFi communication according to TasmoAdmin but the reality is that switching has been flawless.

      Keep at it.

      1. I gave up on the Sonoff flashing and have been trying out Arduino IDE instead. I have sucessfully flashed three types of WeMos boards (both ESP8266 and ESP32) with a variety of sketches. I even had ESP32-Cam running on WiFi after a few falsestarts. I think my Sonoff-FTDI link is the issue. I have just ordered a new one, even though the old one worked for Ard. IDE and WeMos D1R2. There is a lot to learn which makes for a great hobby!

        1. Keep at it. I switched across to Tasmota/Sonoff switches after too many hassles with expensive Z-Wave switches and cold showers.

          No more regular reboots of 3 Z-Way home automation systems which all had performance issues.

          One Home Assistant is rock solid and has no trouble handling the increased load I’ve added. MQTT is key to this and that is how the Tasmota/Sonoff switches work.

Leave a Reply

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