Possible to get ESPhome checking firmware URL and doing OTA?

Struggling to get some battery powered ESP8266 (Wemos D1) properly managed in my network. Since they are in deep sleep I have tried to follow the instructions on MQTT messaging to keep the nodes alive to perform OTA but no luck so far.
Are there are way to get the node to check an URL for an updated firmware and perform the OTA update with the firmware from that URL? Would be nice to have this done once a day for example.

I have monitoring of 10 beehives running on battery powered D1s waking up every 90 minutes to report temperature. Would be nice to have a way to flash them if needed without having to collect the boxes :slight_smile:

2 Likes

Some years laters …

I wrote an external component that is able to do so. It’s tested with esp32-arduino, but it might works for 8266:

external_components:
  - source: github://oarcher/piotech/


ota_http:


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)"

For the moment, it’s mainly a test/draft, but i will work more of it in case of interest.

4 Likes

@oarcher, this is what I was looking for :smiley:
want to use this to remotely update devices that are outside the local network.

I will test and let you know if it works.

greetings
woojtekk

Hello, this is something i wasl looking for in those days, but when i compile i have this problem:

Compiling .pioenvs/00-esp8285-batt-test/src/esphome/components/output/float_output.cpp.o
Compiling .pioenvs/00-esp8285-batt-test/src/esphome/components/rtttl/rtttl.cpp.o
Compiling .pioenvs/00-esp8285-batt-test/src/esphome/components/sntp/sntp_component.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_
*** [.pioenvs/00-esp8285-batt-test/src/esphome/components/ota_http/ota_http.cpp.o] Error 1
========================= [FAILED] Took 107.86 seconds =========================

i am using esphome v2023.6.4, woojtekk did you tried it?, this is something it will be perfect for many users

Hi, I encountered the same problem as you did. The library mentioned in the article does not seem to support ESP8266. I tried using it with ESP8266 but was not successful.

oarcher this is absolutely amazing. I reeeeeeaaaaalllly need it :slight_smile: Any chance you can support esp-idf ? The devices I use need to have TLS as well, and as far as I am aware, the TLS support is only available for esp-idf.

1 Like

+1
really need here too

sorry for late replay. long holiday :wink:

I using ota_http on esp-01 and esp-d1 mini and it works perfectly.
Several of my devices work away from home using MQTT and a slow GPRS connection (mainly weather stations, irrigation monitoring and the like).
So far I have not had any problems.

greetings
woojtekk