I CHANGED EVERYTHING

blakadder 2019-04-08 00:36:26 +02:00
parent 0aaa99e0e5
commit 4756f2ea66
1 changed files with 92 additions and 51 deletions

143
Upload.md

@ -1,75 +1,116 @@
## PlatformIO
If you have followed [Hardware preparation](Hardware-preparation) your device is in Flash Mode and ready to be flashed with Tasmota and for that you need a **flashing tool**.
1. Download the latest [Sonoff-Tasmota "Source code (zip)"](https://github.com/arendst/Sonoff-Tasmota/releases) and extract it - you may also *git clone* the repository
2. Load the Sonoff-Tasmota base folder in [PlatformIO](https://github.com/platformio)
3. Connect the Sonoff module in Flash Mode (see [Hardware Preparation](https://github.com/arendst/Sonoff-Tasmota/wiki/Hardware-Preparation) section and device specific articles)
4. Select a firmware variant to flash onto your module by uncommenting one of the `env_default` lines in [platformio.ini](https://github.com/arendst/Sonoff-Tasmota/blob/master/platformio.ini), see below for variant details. You may also need to change the `upload_port` to match the communications port of the USB serial interface.
5. Open `my_user_config.h` and configure your WiFi settings and optionally your MQTT, Syslog, WebServer, NTP, etc. settings
6. Select "Upload" from the menu to flash the firmware
7. After successful transfer of the firmware disconnect the module
# NodeMCU PyFlasher
NodeMCU PyFlasher is an easy to use GUI flasher based on [esptool.py](https://github.com/espressif/esptool) and is our recommended tool for a quick and easy flash.
Continue at ["First Steps"](https://github.com/arendst/Sonoff-Tasmota/wiki/Initial-Configuration) and be sure to check out the instructions to [connect additional sensors](https://github.com/arendst/Sonoff-Tasmota/wiki/Sensor-Configuration).
Download the [latest release](https://github.com/marcelstoer/nodemcu-pyflasher/releases) for your platform (Windows or Mac). Double click the downloaded file and it'll start, no installation required.
#### Firmware Variants
![NodeMCU PyFlasher Screenshot](https://user-images.githubusercontent.com/5904370/55689926-2a820100-598b-11e9-8153-9a327b216d0d.png)
The default environment configuration generates multiple firmware variants. To build and/or flash exactly one of these, uncomment one of the `env_default` lines in [platformio.ini](https://github.com/arendst/Sonoff-Tasmota/blob/master/platformio.ini).
1. Select **Serial port** (COM# port) where your serial-to-USB or NodeMCU/D1 mini is connected. Leave on auto-select if not sure.
2. **Browse** to the binary you downloaded from [Tasmota GitHub releases](https://github.com/arendst/Sonoff-Tasmota/releases).
3. Set **Baud rade** to **115200** and **Flash mode** to **DOUT**. **Erase flash** to **yes** if it is the first time flashing Tasmota on the device or you're experiencing issues with existing flash. If you're upgrading Tasmota set to **no**.
4. Click **Flash NodeMCU** (Slightly misleading, I know!) and watch the progress in console.
* `sonoff.bin` - the default firmware for all devices
* `sonoff-minimal.bin` - is interim firmware to be used when the above firmware images become too big to fit as OTA or web upload; installing this one first and THEN uploading the desired sonoff.bin allows for future firmware size growth over the OTA file limit of 1/2 flash size.
* `sonoff-sensors` - is a version with most common used sensors enabled
If the flash was successful the console will display:
## Arduino IDE
![Flash succeeded](https://user-images.githubusercontent.com/5904370/55690010-489c3100-598c-11e9-8135-e44469037e11.png)
See the upload section from [Arduino IDE](https://github.com/arendst/Sonoff-Tasmota/wiki/Arduino-IDE) in the right hand menu.
Unplug your adapter or device and plug it back in or connect to another power source. Your device is now ready for Initial configuration.
Continue at ["First Steps"](https://github.com/arendst/Sonoff-Tasmota/wiki/Initial-Configuration) and be sure to check out the instructions to [connect additional sensors](https://github.com/arendst/Sonoff-Tasmota/wiki/Sensor-Configuration).
### Common mistakes
Message `COM# failed to connect: Failed to connect to Espressif device: Timed out waiting for packet header` means your device is not connected (recheck COM port number and USB cable) or not in flash mode (retry flash mode procedure for your device).
## Esptool
# Esptool.py
This method allows you to flash the pre-built release binaries directly onto the device. You will need the latest version of the [esptool.py](https://github.com/espressif/esptool) tool.
Esptool is the official tool for flashing ESP8266 chips and is the most reliable.
0. Boot into flash mode.
1. Backup the flash
It requires Python, if you do not have an installed copy of Python 2.x or 3.x download and install it from https://www.python.org.
Download Esptool Source code from https://github.com/espressif/esptool/releases to a folder of your choice.
Go to the folder and install Esptool with command
```
esptool.py read_flash 0x00000 0x100000 sonoff-backup.bin
python setup.py install
```
2. Reboot into flash mode and Erase the flash
Esptool for [Debian](https://packages.debian.org/stretch/esptool) and [Ubuntu](https://packages.ubuntu.com/cosmic/esptool) is installed with
```
esptool.py erase_flash
sudo apt install esptool
```
3. Reboot into flash mode and Install the new image
### Upload Tasmota
Make sure you followed the steps to put your device in flash mode.
Esptool uses the serial interface to communicate with your device. On Windows these interfaces are named COM1, COM2, etc. On Linux these interfaces are called /dev/ttyUSB0, /dev/ttyUSB1, etc.
Before using Esptool make sure you know which serial interface your device is connected to.
In the following commands I use `COM5` as an example. Change `COM5` with your port designation.
Ensure the device is in flash mode before each step.
#### *Optional:* Backup firmware
Backup the current firmware with the following command:
```
esptool.py --port COM5 read_flash 0x00000 0x100000 fwbackup.bin
```
*When the command completes the device is not in flash mode anymore.*
#### Erase firmware
Erase the complete flash memory holding the firmware with the following command:
```
esptool.py --port COM5 erase_flash
```
It only takes a few seconds to erase 1M of flash.
*When the command completes the device is not in flash mode anymore.*
#### Upload firmware
Load the downloaded Tasmota firmware file *sonoff.bin* with the following command:
```
esptool.py write_flash --flash_size 1MB --flash_mode dout 0x00000 sonoff.bin
esptool.py --port COM5 write_flash -fs 1MB -fm dout 0x0 sonoff.bin
```
*When the command completes the device is not in flash mode anymore.*
**For proper device initialization after the firmware upload power down and power up the device.**
## Esptool executable
The executable version of esptool is maintained by Ivan Grokhotkov and releases are kept at [https://github.com/igrr/esptool-ck/releases](https://github.com/igrr/esptool-ck/releases). Supports Linux, Linux ARM, Windows 32bit and Mac
### Download and install
For the purpose of simplicity only the Windows version will be explained here, but the commands and parameters are the same for Windows, Linux and Mac.
Download the latest release of [Esptool-CK](https://github.com/igrr/esptool-ck/releases) and extract the compressed file to a folder of your choice.
### Upload Tasmota
Download the Tasmota firmware file [sonoff.bin](https://github.com/arendst/Sonoff-Tasmota/releases) to the same folder as Esptool-CK to simplify the process.
In the following commands I use `COM5` as an example. Change `COM5` with your port designation.
Ensure the device is in flash mode before each step.
Erase the existing flash
```
esptool -cp COM5 -cb 115200 -ce -v
```
----
Once the erase is complete, put device back into flash mode and upload the firmware
```
esptool -cp COM5 -cb 115200 -bm dout -cf sonoff.bin -v
```
# Flashing and compiling from source
Tutorials for setting up development environments if you want to modify the code or default settings and compile your own binaries.
- [**PlatformIO**](PlatformIO) - setup and configure [PlatformIO](https://platformio.org) for Tasmota compilation and upload
- [**PlatformIO CLI**](PlatformIO-CLI) - how to flash Tasmota using the PlatformIO command line interface on Linux
- [**Arduino IDE**](Arduino-IDE) - setup and configure Arduino IDE for Tasmota compilation and upload
- [**Visual Studio Code**](Visual-Studio-Code) - setup and configure [Visual Studio Code](https://code.visualstudio.com) with PlatformIO for Tasmota
## Device Configuration
## Need more help?
If you have encountered problems during flash see [Troubleshooting](https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting#flashing-issues). Ask for help in [Discord](https://discord.gg/Ks2Kzd4) or [Community Forum](https://groups.google.com/d/forum/sonoffusers)
Before compiling consider modification of `STA_SSID1` and `STA_PASS1` values inside of `user_config.h` to match your WiFi SSID and WiFi password.
#define STA_SSID1 "indebuurt1" // [Ssid1] Wifi SSID
#define STA_PASS1 "VnsqrtnrsddbrN" // [Password1] Wifi password
This operation simplifies further [first steps](https://github.com/arendst/Sonoff-Tasmota/wiki/Initial-Configuration), as Sonoff will automatically recognize and join your WiFi.
Setting the DST/Standard Time rules in user_config.h will also simplify future configuration
#define TIME_DST North, Last, Sun, Mar, 2, +120 // Northern Hemisphere, Last sunday in march at 02:00 +120 minutes
#define TIME_STD North, Last, Sun, Oct, 3, +60 // Northern Hemisphere, Last sunday in october 03:00 +60 minutes
Do not be tempted to use other board types within the Arduino IDE (e.g. if programming Wemos etc.) if you want to use Tasmota's OTA updating, as this can cause failure and require serial port reprogramming. Always use the Generic ESP board as stated above.
If your new configuration does not seem to be applied after flashing then you can do any of the following to fix it:
* Change the [CFG_HOLDER](https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting#cfg_holder-explained) value in user_config.h and re-flash
* Hold down the button on your device for at least 4 seconds to initiate a RESET command
* Reset the device via the Web Console
### Problems
Check the [Troubleshooting](https://github.com/arendst/Sonoff-Tasmota/wiki/Troubleshooting#flashing-issues) page if got problems while flashing.
Tasmota is flashed and your device and ready for Initial Configuration.