oarcher / piotech Goto Github PK
View Code? Open in Web Editor NEWmy custom components for esphome
my custom components for esphome
This will allow to fix #3
Thank for creating this, it's very useful for mqtt. It works on all my esp boards except this smart socket for some reason. esp8266: / board: esp8285 with 1M flash. I already had to use esp8266_disable_ssl_support to keep it under 50%, I don't think it's possible without it on a 1M board. Maybe it is worth mentioning in the readme, it took me some time to find this config option. Anyhow, the normal wireless ota update of esphome has no problem when it's in the same network as my server (IIS reverse proxy to a VM running home assistant).
[09:03:05][D][button:010]: 'bw_shp6_7_15a Firmware update' Pressed.
[09:03:05][D][ota_http:046]: Trying to connect to http://hassio.timbuktu.hu/local/esphome/bw_shp6_7_15a/firmware.bin
[09:03:05][E][ota_http:084]: Incorrect file size (-1) reported by http server (http status: -1). Aborting
[09:03:05][W][ota_http:065]: BACKEND->begin error: 255
[09:03:05][E][ota_http:133]: Abort http con
[09:03:05][D][main:105]: This message should be not displayed (reboot)
firmware.bin is not there, it contains my wifi credentials, but I can assure you even wget can download it.
wget -S http://hassio.timbuktu.hu/local/esphome/bw_shp6_7_15a/firmware.bin
--2023-11-16 10:10:54-- http://hassio.timbuktu.hu/local/esphome/bw_shp6_7_15a/firmware.bin
Resolving hassio.timbuktu.hu (hassio.timbuktu.hu)... 176.241.45.141
Connecting to hassio.timbuktu.hu (hassio.timbuktu.hu)|176.241.45.141|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Cache-Control: public, max-age=2678400
Content-Length: 494752
Content-Type: application/octet-stream
Last-Modified: Thu, 16 Nov 2023 03:15:44 GMT
Accept-Ranges: bytes
ETag: "1797fc134225c000-78ca0"
Server: Microsoft-IIS/10.0
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Powered-By: ARR/3.0
X-Powered-By: ASP.NET
Date: Thu, 16 Nov 2023 09:10:54 GMT
Length: 494752 (483K) [application/octet-stream]
Saving to: 'firmware.bin'
firmware.bin 100%[=========================================>] 483.16K --.-KB/s in 0.02s
2023-11-16 10:10:54 (19.7 MB/s) - 'firmware.bin' saved [494752/494752]
Having upgraded to the latest esphome (2023.10.6) I noticed that I am unable to get to the point after the GET
Running the old code that used to work for me is also failing at the same point.
Perhaps related to some esphome changes?
replaced my URL below
[15:27:42][D][ota_http:046]: Trying to connect to https://example.com/g.bin
[15:27:42][ 34064][V][HTTPClient.cpp:252] beginInternal(): url: https://example.com/g.bin
[15:27:42][ 34071][D][HTTPClient.cpp:263] beginInternal(): unexpected protocol: https, expected http
[15:27:42][ 34079][V][HTTPClient.cpp:252] beginInternal(): url: https://example.com/g.bin
[15:27:42][ 34088][D][HTTPClient.cpp:303] beginInternal(): protocol: https, host: example.com port: 443 url: /g.bin
[15:27:42][V][ota_http:061]: http begin successfull.
[15:27:42][VV][ota_http:065]: http client setReuse.
[15:27:42][V][ota_http:069]: http headers collected.
[15:27:42][ 34122][D][HTTPClient.cpp:598] sendRequest(): request type: 'GET' redirCount: 0
[15:27:42]
[15:27:42][ 34122][V][ssl_client.cpp:62] start_ssl_client(): Free internal heap before TLS 80468
[15:27:42][ 34129][V][ssl_client.cpp:68] start_ssl_client(): Starting socket
[15:27:42][ 34148][V][ssl_client.cpp:149] start_ssl_client(): Seeding the random number generator
[15:27:42][ 34150][V][ssl_client.cpp:158] start_ssl_client(): Setting up the SSL/TLS structure...
[15:27:42][ 34153][D][ssl_client.cpp:179] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
[15:27:42][ 34161][V][ssl_client.cpp:257] start_ssl_client(): Setting hostname for TLS session...
[15:27:42][ 34170][V][ssl_client.cpp:272] start_ssl_client(): Performing the SSL/TLS handshake...
[15:27:47]E (42691) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[15:27:47]E (42691) task_wdt: - loopTask (CPU 1)
[15:27:47]E (42691) task_wdt: Tasks currently running:
[15:27:47]E (42691) task_wdt: CPU 0: IDLE
[15:27:47]E (42691) task_wdt: CPU 1: IDLE
[15:27:47]E (42691) task_wdt: Aborting.
[15:27:47]
[15:27:47]abort() was called at PC 0x401184d4 on core 0
[15:27:47]
[15:27:47]
[15:27:47]Backtrace:0x40083a45:0x3ffbeb3c |<-CORRUPTED
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40083a45: panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
Hi Again Oarcher.
Im running the PR build, and its fracking awesome. A few times, if I forget to enable the http server (so the unit doesn't have access) it will go into eternal fault mode. And need to be restarted before I can proceed. The unit is still alive, but in some sort of loop. I can't get any other data out from it other than a fault code "Error read data" and it won't listen to restart requests or similar.
The fail safe boot is on default setting.
This is all the log shows.
- platform: template
name: "Firmware Update"
id: firmware_update_action
on_press:
then:
- ota_http.flash:
url: !lambda |-
return str_sprintf("https://myserver.com%s", id(upgrade_path).state);
I need to specify a dynamic path but it would seem that the component does not allow this
I replaced the URL of my server with example.com and also the filename to hide the contents on my server
[17:40:50][D][ota_http:098]: Trying to connect to https://example.com/M8.bin
[17:40:50][ 23242][V][HTTPClient.cpp:252] beginInternal(): url: https://example.com/M8.bin
[17:40:50][ 23246][D][HTTPClient.cpp:263] beginInternal(): unexpected protocol: https, expected http
[17:40:50][ 23254][V][HTTPClient.cpp:252] beginInternal(): url: https://example.com/M8.bin
[17:40:50][ 23264][D][HTTPClient.cpp:303] beginInternal(): protocol: https, host: example.com port: 443 url: /M8.bin
[17:40:50][V][ota_http:112]: http begin successfull.
[17:40:50][V][ota_http:121]: md5sum from received data initialized.
[17:40:50][V][ota_http:125]: http headers collected.
[17:40:50][ 23302][D][HTTPClient.cpp:598] sendRequest(): request type: 'GET' redirCount: 0
[17:40:50]
[17:40:50][ 23303][V][ssl_client.cpp:62] start_ssl_client(): Free internal heap before TLS 139344
[17:40:50][ 23306][V][ssl_client.cpp:68] start_ssl_client(): Starting socket
[17:40:50][ 23330][V][ssl_client.cpp:149] start_ssl_client(): Seeding the random number generator
[17:40:50][ 23332][V][ssl_client.cpp:158] start_ssl_client(): Setting up the SSL/TLS structure...
[17:40:50][ 23335][D][ssl_client.cpp:179] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE!
[17:40:50][ 23343][V][ssl_client.cpp:257] start_ssl_client(): Setting hostname for TLS session...
[17:40:50][ 23351][V][ssl_client.cpp:272] start_ssl_client(): Performing the SSL/TLS handshake...
[17:40:51][ 24704][V][ssl_client.cpp:293] start_ssl_client(): Verifying peer X.509 certificate...
[17:40:51][ 24705][V][ssl_client.cpp:301] start_ssl_client(): Certificate verified.
[17:40:51][ 24708][V][ssl_client.cpp:316] start_ssl_client(): Free internal heap after TLS 96444
[17:40:51][ 24716][D][HTTPClient.cpp:1156] connect(): connected to example.com:443
[17:40:51][ 24725][V][ssl_client.cpp:369] send_ssl_data(): Writing HTTP request with 173 bytes...
[17:40:51][ 24779][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'HTTP/1.1 200 OK'
[17:40:51][ 24780][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Date: Wed, 18 Oct 2023 15:40:37 GMT'
[17:40:51][ 24785][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Server: Apache'
[17:40:51][ 24791][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Last-Modified: Fri, 06 Oct 2023 13:45:40 GMT'
[17:40:51][ 24801][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Accept-Ranges: bytes'
[17:40:51][ 24808][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Content-Length: 1337376'
[17:40:51][ 24816][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Keep-Alive: timeout=5, max=100'
[17:40:51][ 24824][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Connection: Keep-Alive'
[17:40:51][ 24832][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: 'Content-Type: application/octet-stream'
[17:40:51][ 24840][V][HTTPClient.cpp:1250] handleHeaderResponse(): RX: ''
[17:40:51][ 24846][D][HTTPClient.cpp:1307] handleHeaderResponse(): code: 200
[17:40:51][ 24852][D][HTTPClient.cpp:1310] handleHeaderResponse(): size: 1337376
[17:40:51][ 24858][D][HTTPClient.cpp:628] sendRequest(): sendRequest code=200
[17:40:51]
[17:40:51][V][ota_http:131]: http GET finished.
[17:40:51][D][ota_http:144]: firmware is 1337376 bytes length.
[17:40:51][D][ota_http:042]: Using ArduinoESP32OTABackend
[17:40:51][ 24887][D][Updater.cpp:133] begin(): OTA Partition: app1
[17:40:55]E (38930) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
[17:40:55]E (38930) task_wdt: - loopTask (CPU 1)
[17:40:55]E (38930) task_wdt: Tasks currently running:
[17:40:55]E (38930) task_wdt: CPU 0: IDLE
[17:40:55]E (38930) task_wdt: CPU 1: IDLE
[17:40:55]E (38930) task_wdt: Aborting.
[17:40:55]
[17:40:55]abort() was called at PC 0x401032cc on core 0
[17:40:55]
[17:40:55]
[17:40:55]Backtrace:0x40083915:0x3ffbeaec |<-CORRUPTED
WARNING Found stack trace! Trying to decode it
WARNING Decoded 0x40083915: panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
[17:40:55]
[17:40:55]
[17:40:55]
[17:40:55]
[17:40:55]ELF file SHA256: 0000000000000000
[17:40:55]
[17:40:55]Rebooting...
[17:40:55]ets Jul 29 2019 12:21:46
Hello, i am really happy about this function, it is really what I was looking for, the problems is when i am going to compile, i receive this error:
Compiling .pioenvs/00-esp8285-batt-test/src/esphome/components/script/script.cpp.o
src/esphome/components/ota_http/ota_http.cpp: In function 'bool esphome::ota_http::http_connect(HTTPClient*, std::string)':
src/esphome/components/ota_http/ota_http.cpp:63:23: error: 'const class String' has no member named 'compare'; did you mean 'compareTo'?
63 | bool secure_ = url_.compare(0, 6, "https:") == 0;
| ^~~~~~~
| compareTo
src/esphome/components/ota_http/ota_http.cpp:68:28: error: 'using element_type = class WiFiClient' {aka 'class WiFiClient'} has no member named 'setInsecure'
68 | wifi_client_secure_->setInsecure();
| ^~~~~~~~~~~
src/esphome/components/ota_http/ota_http.cpp:69:28: error: 'using element_type = class WiFiClient' {aka 'class WiFiClient'} has no member named 'setBufferSizes'
69 | wifi_client_secure_->setBufferSizes(512, 512);
| ^~~~~~~~~~~~~~
src/esphome/components/ota_http/ota_http.cpp:86:18: error: 'client' was not declared in this scope; did you mean 'client_'?
86 | begin_status = client->begin(*wifi_client_, url_);
| ^~~~~~
| client_
Compiling .pioenvs/00-esp8285-batt-test/src/esphome/components/sensor/automation.cpp.o
*** [.pioenvs/00-esp8285-batt-test/src/esphome/components/ota_http/ota_http.cpp.o] Error 1
========================= [FAILED] Took 69.60 seconds =========================
Hope there is a solution, i am using an ESP8285 and this function is perfect to enable autoupdate from my own server, when the ESP is in another house and i do not want to open a port on the modem.
To test the option i copy your configuration and changed just the url
Thanks for this good option !!!!!!!!!!!!!!!!!!
Error when compiling:
This feature is incompatible with esp-idf.
I recompiled known working yaml file on the latest esphome (Version: 2023.12.9)
I recently upgraded esphome (was on 10.6 before)
Same yaml code that used to work.
I tried looking at the branch and do not see many changes.
Relevant log below:
19:34:22 [I] [ota_http:111] Progress: 0.1%
19:34:22 [E] [ota_http:103] Error code (131) writing binary data to flash at offset 4000 and size 1493968
19:34:22 [E] [ota_http:150] Abort OTA backend
19:34:22 [E] [ota_http:153] Abort http con
19:34:22 [E] [ota_http:155] previous safe mode didn't succed. ota_http skipped
Perhaps changes in OTA backend that are not compatible with ota_http?
I have an ESP32C3-based board with esphome flashed, and tried using this component to have it pull new firmware.
This is the log output:
[11:42:34][D][ota_http:098]: Trying to connect to http://ha-bracelets.local:8123/local/bracelets_firmware/b105.bin
[11:42:34][V][ota_http:112]: http begin successfull.
[11:42:34][VV][ota_http:116]: http client setReuse.
[11:42:34][V][ota_http:121]: md5sum from received data initialized.
[11:42:34][V][ota_http:125]: http headers collected.
[11:42:34][V][ota_http:131]: http GET finished.
[11:42:34][D][ota_http:145]: firmware is 1172720 bytes length.
[11:42:34][D][ota_http:042]: Using ArduinoESP32OTABackend
[11:42:34][VV][ota_http:158]: Got esp32 stream
[11:42:34][D][ota_http:195]: Progress: 0.1%
[11:42:35][D][ota_http:195]: Progress: 6.4%
[11:42:36][D][ota_http:195]: Progress: 12.7%
[11:42:37][D][ota_http:195]: Progress: 18.9%
[11:42:39][D][ota_http:195]: Progress: 25.2%
[11:42:40][D][ota_http:195]: Progress: 31.5%
[11:42:41][D][ota_http:195]: Progress: 37.6%
[11:42:42][D][ota_http:195]: Progress: 43.7%
[11:42:43][D][ota_http:195]: Progress: 50.7%
[11:42:44][D][ota_http:195]: Progress: 60.7%
[11:42:45][D][ota_http:195]: Progress: 67.5%
[11:42:46][D][ota_http:195]: Progress: 77.4%
[11:42:47][D][ota_http:195]: Progress: 84.3%
[11:42:48][D][ota_http:195]: Progress: 90.5%
[11:42:49][D][ota_http:195]: Progress: 98.9%
[11:42:49][D][ota_http:195]: Progress: 100.0%
[11:42:49][I][ota_http:204]: Done in -185074578797902317207421028936074846135862769981177779226067362725658385491025278032410729529558311763762167874532392951006107027894768590644056147060628029635789192700879247530437045176509745606127680908602101329748211793920 secs
[11:42:49][D][ota_http:209]: md5sum recieved: a0464b0d0d31b4d4c84c6e4fa8e27856 (size 1172720)
[11:42:49][I][ota_http:228]: OTA update finished! Rebooting...
[11:42:49][I][app:134]: Rebooting safely...
Everything looks just fine other than... the time, but upon reboot the old firmware is still running. Any idea?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.