Posted on 15 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.

Posted on 1 Comment

Coronavirus and electronics production

I’m sure you’ve heard of the crazy coronavirus epidemic that’s rapidly spreading around the world, and has now been declared a global health emergency by the World Health Organization.

One of the areas that has been hardest hit by the virus is the city of Wuhan, on the Yangtze River in east-central China. Wuhan went into a state of lockdown on January 23rd, with businesses closed and everyone told to stay home and avoid contact with other people.

China is taking this threat extremely seriously, responding on a scale that I don’t think would be possible in any other country. I don’t know of anywhere else in the world that could build entire 1000-bed hospitals from the ground up in 6 days, just to respond to a sudden medical need. If anyone can face a challenge like this, it’s the Chinese.

The primary focus has to be on the health of those in the affected areas, of course. So far I haven’t heard of any of my Chinese colleagues being infected, and I hope it stays that way.

Bare PCBs for both Freetronics and SuperHouse products are mostly produced by Gold Phoenix, which is located in Wuhan, right in the bullseye of the epidemic. Like almost all businesses in Wuhan, Gold Phoenix has told workers to stay home and stay safe.

Some of our prototype PCBs are produced in factories around the city of Shenzhen, in southern China just over the border from Hong Kong. Those factories are currently closed too.

Our PCBA (PCB Assembly, which includes pick-and-place installation of parts on the boards) and final testing and packaging is done in Beijing, which has now also gone into lockdown. Not only are factories closed, but roads out of the cities have been closed to prevent the spread of infection so any boards that have aleady been produced are stuck in warehouses.

There are currently batches of EtherMega and EtherTen boards that were scheduled to ship a few days ago, but they are now caught up in the lockdown and can’t leave Beijing.

So over the next little while there will probably be stock problems for both Freetronics and SuperHouse. Please be patient while I do my best to assemble what I can using local stock of bare PCBs and parts, and keep in mind the millions of people who are now stuck at home with dwindling food supplies. It may be frustrating that products are out of stock, but that’s really not important when the health of so many people is at stake.