-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[ota] http_request update platform #5586
Conversation
Hey there @oarcher, CODEOWNERS = ["@oarcher"] And run (message by NeedsCodeownersLabel) |
I can see that PR #5535 change the implementation of OTA backend in error_code = esphome::ota_http::OtaHttpComponent::BACKEND->begin(this->body_length_); should become: error_code = esphome::ota_http::OtaHttpComponent::BACKEND->begin(OTA_BIN_APP, this->body_length_); |
"https only supported for esp32" - does it mean that https is supported on esp32 only, not other platforms, or that esp32 supports https only, no http for example? |
Sorry for the confusion. https and http works for esp32. I've edited the PR description with http/https support matrix. |
@nerijus Previous commit has fixed https for 8266. |
So the line "https only supported for esp32" can probably be removed at all? |
@oarcher - following with our conversation - can you please take a look at the split of the OTAComponent I drafted at angelnu#1 Basically splitted the socket usage as frontend (see ota_socket component). It compiles but I did not test it yet - if this would also work for http I would clean up the code and take care of other issues UPDATE |
Man I have to say again @oarcher. This thing is a beast. Probably used it a couple of hundred times by now. Its amazing. Good job man. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #5586 +/- ##
==========================================
+ Coverage 53.70% 53.90% +0.19%
==========================================
Files 50 50
Lines 9408 9623 +215
Branches 1654 1698 +44
==========================================
+ Hits 5053 5187 +134
- Misses 4056 4112 +56
- Partials 299 324 +25 ☔ View full report in Codecov by Sentry. |
Possible to support the advanced updater which allows the server to determine if there should be an OTA update performed? Useful for automatic updates or pushing specific updates to specific clients depending on the version string passed. Wasn't able to find official up to date documentation, but am remembering something along these lines from years ago: https://arduino-esp8266.readthedocs.io/en/latest/ota_updates/readme.html#advanced-updater |
Hi All, |
@paulsteigel , mqtt:
broker: mqttbrocker.example.com
username: mqtt_username
password: mqtt_password
button:
- platform: template
name: "Firmware update"
on_press:
then:
- ota_http.flash:
url: http://example.com/firmware.bin
verify_ssl: false
- logger.log: "This message should be not displayed(reboot)" |
@kevireilly , yes, I plan to add this feature to But for now, I'm waiting for the main esphome maintainers to merge this PR. |
Hi @oarcher,
My esphome configuration is here
My webpage.com.vn is the the replacement of my real address to avoid security risks. It shown that firmware was download successfully but failed in installing.
|
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Hi @kbx81 and @oarcher,
I used the config from @kbx81 and the compiler complained that "force_update is invalid option for ota_http_request.flash:"
Can you please be so kind to advice me on what I am doing wrong. |
@paulsteigel , the For http_request:
id: http_data
button:
- platform: template
name: "http_request test"
on_press:
- http_request.get:
url: https://myhome.sfdp.net/local/${name}/firmware.md5
verify_ssl: false
on_response:
then:
- logger.log:
format: 'Response status: %d, Duration: %u ms'
args:
- status_code
- duration_ms
- lambda: |-
ESP_LOGI("test", "content: %s", id(http_data).get_string()); Also try with a public server url, like |
Many thanks to @oarcher |
If you specify a static IP be sure to also include the nameserver entry in your network configuration. I once spent a whole day trying to figure out why I could work from an IP and not to my domain. I remember the error message was very confusing but I cannot recall if this is the same case |
What does this implement/fix?
ota in client (http) mode: This allow to do a remote ota when the device is far away, behind a firewall, and only reachable with mqtt. (For ex in another house).
As the ota might be triggered by mqtt, a long time deep sleep can be defined.
original component from https://github.com/oarcher/piotech/tree/main/components/ota_http
Types of changes
Related issue or feature (if applicable): fixes esphome/feature-requests#801
Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3291
Test Environment
Http/Https support matrix
Example entry for
config.yaml
:Example config.yaml
Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: