Skip to content

Commit

Permalink
Add detail on partition updating (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubedzero committed Mar 18, 2024
1 parent fe2757d commit 8751423
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,20 @@ Writing to the bootloader over OTA is dangerous and not normally done for good r
## Part 4: Tasmota Setup

- **TL;DR: Connect to the Tasmota WiFI. Configure the actual WiFi. Update the firmware. Apply the SwitchBot Tasmota Template. Configure the device**
- NOTE: The NodeJS server is configured to flash Tasmota `tasmota32c3.factory.bin` which is described to be a "Factory binary to be used for initial flashing using esptool." The distinguishing factor is that a factory binary includes an entire partition table, bootloader, etc. rather than just application partition that is later sent for OTA binaries in the future.
- NOTE: The flashed Tasmota version is `v11.1.0 Ostara` and not a later version. This is because `v12.0.0 Paul` changed the partition layout, making the ESPHome firmware harder to flash onto the plug. This change is described in more detail at https://tasmota.github.io/docs/Safeboot/
- Connect to the Tasmota WiFi. It should be an unsecured WiFi network with SSID `tasmota-0c3d4f-1234` showing a portion of the WiFi MAC address and a random number. Once connected, configure it to connect to the real WiFi network. It will likely reuse the IP address it had earlier during the flashing process, which in this example was 192.168.0.131.
- NOTE: The NodeJS server is configured to flash Tasmota `tasmota32c3.factory.bin` which is described to be a "Factory binary to be used for initial flashing using esptool." The distinguishing factor is that a factory binary includes an entire partition table, bootloader, etc. rather than just application partition that is later sent for OTA binaries in the future
- NOTE: The flashed Tasmota version is `v11.1.0 Ostara` and not a later version. This is because `v12.0.0 Paul` changed the partition layout to have a Safeboot partition, making the ESPHome firmware harder to flash onto the plug. This change is described in more detail [here](https://tasmota.github.io/docs/Safeboot/)
- Connect to the Tasmota WiFi. It should be an unsecured WiFi network with SSID `tasmota-0c3d4f-1234` showing a portion of the WiFi MAC address and a random number. Once connected, configure it to connect to the real WiFi network. It will likely reuse the IP address it had earlier during the flashing process, which in this example was 192.168.0.131
- Reconnect your phone to the real WiFi network and navigate to the Tasmota webpage, in this case http://192.168.0.131. Click "Firmware Upgrade," confirm the OTA URL is http://ota.tasmota.com/tasmota32/release/tasmota32c3.bin or something similar, and click "Start Upgrade." Wait a few minutes as the plug updates its firmware and reconnects to WiFi
- NOTE: The firmware upgrade may only succeed once, due to the first Tasmota firmware being a factory version that is easily overwritten. Subsequent firmware upgrades may fail silently, meaning the device reboots but the firmware doesn't actually upgrade. Check the console for signs of an error such as `{"StatusSTK":{"Exception":7,"Reason":"Store access fault","EPC":"403832ae","EXCVADDR":"00000000","CallChain":["40387caa","4038be68","420adf92","4038d178","403801ee","421161a0","42115638","42096b3e","42096bd6","42013be6"]}}` to validate if this is happening. This is due to the mismatch in partition layout
- The partition layout can be fixed by using the Tasmota Application "Partition Wizard" which can be downloaded from [here](https://tasmota.github.io/docs/Tasmota-Application/#partition-management). Partition Manager is also available but is not needed for this process. Download the `Partition Wizard.tapp` file to your computer
- Go to the SwitchBot Tasmota interface, into "Consoles" and then "Manage File System." Select the `Partition Wizard.tapp` file and click "Upload." If the page refreshes without showing the newly added file, reboot the Tasmota and try again and it should upload
- Reboot the Tasmota once the file is uploaded to get Tasmota to recognize the app. Then go to "Consoles" and then "Partition Wizard" to see the following page. It shows that the current partition layout is `app0` and `app1` and `fs` which is incompatible with larger firmwares, hence the need for an upgrade. There is thankfully a section to fix this with one button, "Start migration." Click it, confirm the multiple reboots warning, and wait a few minutes. Note that it will also update the firmware as part of this process
- ![pre-partition-wizard](./images/pre-partition-wizard.png)
- After a few minutes, click the Main Menu button to return to the Tasmota main menu. Confirm that the new partition layout has taken effect by going back to the "Partition Wizard" page, or just go to "Information." Both are pictured
- ![post-partition-wizard](./images/post-partition-wizard.png)
- ![post-partition-info](./images/post-partition-info.png)
- The SwitchBot is now prepared to accept future Tasmota firmware updates (though is also now incompatible with the ESPHome partition layout)

- Once the Tasmota page is accessible again, go to "Configuration" and then "Configure Other." In the Template section, paste the following value and check the "Activate" button. Also feel free to change the Device Name, which shows up on the Tasmota home page. Finally, click "Save" and wait for the Tasmota to restart
- `{"NAME":"SwitchBot Smart Plug Mini W1901400","GPIO":[0,0,32,0,0,0,224,320,321,0,0,0,0,0,0,0,0,0,2720,2656,2624,0],"FLAG":0,"BASE":1}`
- The template can also be found on the Tasmota device repository https://templates.blakadder.com/switchbot_plugmini_W1901400.html
Expand All @@ -105,7 +115,7 @@ Writing to the bootloader over OTA is dangerous and not normally done for good r

- Perform the Power Calibration following the instructions in https://tasmota.github.io/docs/Power-Monitoring-Calibration/
- NOTE: Power Calibration is technically optional but not doing it can cause the power readings to be off by an order of magnitude. It is highly recommended to perform Power Calibration
- I used a Kill-a-watt and a portable space heater or hair dryer after confirming it was in a mode that had a Power Factor of 0.99 or 1.0.
- I used a Kill-a-watt and a portable space heater or hair dryer after confirming it was in a mode that had a Power Factor of 0.99 or 1.0
- I then used the Kill-a-watt to note the voltage, wattage, and amperage (in my case, 122.3V, 778W, 6.36A)
- I then used the [Backlog](https://tasmota.github.io/docs/Commands/#the-power-of-backlog) command in the Tasmota Console to write all three values at once: `Backlog0 VoltageSet 122.3; PowerSet 778; CurrentSet 6360`

Expand Down
Binary file added images/post-partition-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/post-partition-wizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/pre-partition-wizard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8751423

Please sign in to comment.