Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dashboard: Adds "compressed=1" to /download.bin endpoint. (...) #4966

Merged
merged 2 commits into from Jun 21, 2023

Conversation

fdcastel
Copy link
Contributor

What does this implement/fix?

Adds "compressed=1" to /download.bin endpoint.

As described in feature-requests#2276, this would greatly simplify future migrations for other users since they could convert a device just issuing two Tasmota commands:

OtaUrl http://my-esphome/download.bin?configuration=my-device.yaml&type=firmware-factory.bin&compressed=1
Upgrade 1

This would instruct Tasmota device to download the image directly from esphome web server and flash itself without human intervention via Tasmota web UI.

Increases download buffer size to 256KB.

The current code uses a 16KB buffer size which seems very small (even for RPI installs).

Since the code doesn't give any rationale as to why this value was chosen I took the liberty of increasing it to 256KB, given that this gave me the ideal compression size in some ad hoc tests I made. It could also benefit (albeit in a much smaller capacity) the download of uncompressed images.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes feature-requests#2276

Pull request in esphome-docs with documentation (if applicable): (none)

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@jesserockz
Copy link
Member

Thanks @fdcastel
Can you add something to https://esphome.io/guides/migrate_sonoff_tasmota.html (https://github.com/esphome/esphome-docs/blob/current/guides/migrate_sonoff_tasmota.rst)?

@nielsnl68
Copy link
Contributor

Cool idea, could this also being made for sonoff and shelly deviices?

@fdcastel
Copy link
Contributor Author

Cool idea, could this also being made for sonoff and shelly deviices?

Sure! For now I migrated only my Tasmota devices.

I do have both Shelly gen1 and gen2 devices, also. But I didn't convert them to ESPHome yet. I wish to better understand how the temperature and overvoltage protection of these devices work before I make the jump.

The two generations differs significantly in its API, but both have something equivalent of OtaUrl Tasmota cited above:

I just don't know about Shelly support of compressed images. For gen2 (ESP32 based devices) firmware size should not be a problem, however.

I will report back here after finished my ESPHome + Shellies tests.

@fdcastel
Copy link
Contributor Author

@jesserockz
Copy link
Member

I believe shelly devices require an intermediate firmware to then flash to a 3rd-party firmware, see: https://github.com/tasmota/mgos32-to-tasmota32

@jesserockz jesserockz added this to the 2023.6.0b7 milestone Jun 21, 2023
@jesserockz jesserockz merged commit f72b07e into esphome:dev Jun 21, 2023
25 checks passed
jesserockz added a commit that referenced this pull request Jun 22, 2023
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
@jesserockz jesserockz mentioned this pull request Jun 22, 2023
@jesserockz jesserockz mentioned this pull request Jun 22, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gzipped images from ESPHome dashboard (easier migration from Tasmota)
3 participants