Troubleshooting - seurat-atreides/Sonoff-Tasmota GitHub Wiki
The logs are available via the web console, serial port and syslog.
The default logging for serial and weblog is 2 (syslog is disabled by default). It is set separately for each log destination.
Log levels range from 0
to 4
. The higher the log level, the more information is logged. When troubleshooting your device its recommended to set loglevel to 4
.
These show up in the Web UI Console (http://deviceip/cs).
WARNING, never connect to serial while the device is connected to mains power. You can still collect the logs, but only when powering it via your serial connection. Some devices use the serial port to control the relays or an MCU, so serial logging might interfere with control and even switch relays or lights.
Through a terminal program set the baud rate to 115200, disable hardware flow control and you will see the logs.
If the ESP8266 crashes, it frequently dumps information about the crash out the serial port, so the process listed above to see serial logs can provide extremely useful information
If you have a Linux system, it is probably running syslog and you just need to configure it to listen on the network.
On systems running rsyslog (most linux distros), edit the file /etc/rsyslog.conf. Adding (or uncommenting) the following lines will probably start making the logs show up in some file under /var/log
$ModLoad imudp $UDPServerRun 514
If you do not have access to a Linux system, there are Microsoft Windows Syslog server options.
This approach solved a lot of small issues. Sometimes this is due to a bad flash, a bad OTA or invalid data that remains in the flash where the SDK memory is.
Erase flash and flash the latest precompiled bins from http://thehackbox.org/tasmota/ over serial.
Using the latest esptool makes this process "rather" easy.
- Go to https://github.com/espressif/esptool and read the README.md regarding installing esptool which boils down to:
- Download and install Python for your operating system from https://www.python.org
- Open a command prompt and install pyserial with command
pip install pyserial
- Install esptool with command
pip install esptool
- Erase Flash
- Connect your device to a known serial port (say COM5)
- Hold the push button and apply 3.3v power to the device from the USB/serial connecting device
- Erase the complete flash with command
esptool.py --port COM5 erase_flash
- Note: after erasing flash, you must hold push button and apply 3.3v again, before loading new flash
- Load Tasmota into a device with command
esptool.py --port COM5 write_flash -fs 1MB -fm dout 0x0 sonoff.bin
If you don't want to install Python you can download NodeMCU PyFlasher. It offers a checkbox option in the GUI to erase flash before uploading a new binary.
To check the flow of MQTT traffic you can use MQTT Explorer which shows your entire MQTT traffic in an organised and structured way.
Tasmota Device Manager offers an overview of all your Tasmota devices using MQTT protocol. You can manage them, use device features and do basic troubleshooting with ease. It also cleanly displays if your device is dropping from the network often or reboots unexpectedly.
This typically shows up in the device working when it first starts up (hitting the button toggles the relay), but some time later it either reboots or some function won't work.
For example, you can't load the module configuration page.
The only fix for this is to recompile the firmware and disable features you don't need.
Known large features are web server and TLS, but other things to consider disabling if you don't need them are emulation support, Domoticz support, WS8212 support
A 512K firmware binary size is a good "target" and rule of thumb for allowing future OTA firmware updates. Flashing over the air (OTA) requires that there is enough free program memory available to upload the new firmware along with the existing copy before the old copy is deleted. If your firmware binary is larger than the available free program memory, you can replace the existing firmware with a minimal functionality version of Tasmota (roughly 375K). This leaves enough free in the 1024K program memory for the final copy of the firmware (i.e., larger than 512K).
Flashing Tasmota makes it simpler to update to newer versions because it is built for OTA upgrades. In fact, if the new firmware is larger than the available free memory, Tasmota's OTA process will, automatically, first replace the existing firmware with "minimal" to then have enough space to put the new firmware in.
If one is loading firmware only via the serial interface (i.e., wired), then theoretically you could load firmware as large at the program memory size. since you can erase the flash and then fill it to the rim with the new firmware. But then you'd be left with performing upgrades by having to have physical access to the device each time.