Tasmota
Flashing Tasmota
Obtain ESPTool and the latest Tasmota binary. Use ESPTool.py to erase and load Tasmota via serial.
Here is what I did to flash a Wemos D1, for example.
$ python -m esptool --port /dev/ttyUSB0 erase_flash
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 50:02:91:fe:9d:a4
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 8.6s
Hard resetting via RTS pin...
$ python -m esptool --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 tasmota.bin
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 50:02:91:fe:9d:a4
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Compressed 613568 bytes to 438208...
Wrote 613568 bytes (438208 compressed) at 0x00000000 in 38.7 seconds (effective 126.8 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Configuration
After a factory reset, you will need to configure its WiFi settings manually by connecting to the WifiManager created access point. After it connects to the proper network, connect to it again through a web browser.
The following section applies to my own network and setup. For my own network, because the IoT devices are all in its own isolated network, I need to do a SSH tunnel in order to access the web interface. This is done by running: ssh -L 8080:192.168.1.x:80 root@iot-router and then connecting to localhost:8080 in a web browser. In the web interface, there are a few things that needs to be configured in order for it to work properly with the NodeRED/MQTT service outside of the IoT network.
- Setup the device template. Remember to check off 'activate' or else the template won't get applied.
- Configure MQTT. Set the host as
mqtt, port as1883, topic as the device name, and the prefix astasmota/%topic%/. The mqtt hostname resolves to the MQTT server and the IoT router allows MQTT traffic on port 1883 to leave the network to this server.
String formatting
When configuring the Tasmota hostname and MQTT strings, you may substitute variable names. This table outlines what you can use.
| Description | What you type | What you get |
|---|---|---|
| %06X | 0353C0 | |
| last 4 digits of mac | %04d | |
| hostname | %s | |
| MQTT prefix | %prefix% | One of: cmnd, stat, tele
|
| MQTT topic | %topic% | User defined. Eg: WP5-1
|