cotestatnt / AsyncTelegram2

Powerful, flexible and secure Arduino Telegram BOT library. Hardware independent, it can be used with any MCU capable of handling an SSL connection.
MIT License
83 stars 25 forks source link

Please, add OTA example for Ethernet platform #28

Closed woodlist closed 2 years ago

woodlist commented 2 years ago

It is so needed.

cotestatnt commented 2 years ago

Wich kind of board are you planning to use? OTA is strictly related to the type of MCU. In the examples, there is one with ethernet. I've tested with a couple of MCU (STM32 and nRF52832/40) and actually i'm planning to test also with RP2040 and ATSAMD21 (Arduino Zero).

You have to keep in mind that with Telegram server, the SSL handshake in mandatory so the board must have power enought. Uno, Mega etc etc, are boards not able to run SSL communications as far as I know.

woodlist commented 2 years ago

Thanks for reply. Im planning to use on ESP32.

cotestatnt commented 2 years ago

That's sound good, because you have all computational power needed. I've tried to take a look at the libraries for OTA update with ESP32 platform: unluckily ESP32 HTTPUpdate library is meant to be used only with WiFiClientor WiFiClientSecureclass.

In any case, this forcing does not arise from technical needs. In my opinion the developers have assumed that if there is WiFi no one needs to use an Ethernet connection, so @woodlist I have a good news for you ;) Just redefining methods of HTTPUpdateand HTTPClientlibraries (ad some others small things), you can use HTTPUpdateeven with EthernetClient througth SSLClientand IT WORKS like a charm!

Here you can find a working example (the same as for ESP8266, but adapted and tested for a NodeMCU-32S board and W5500 Ethernet shield). I've uploaded in dev branch, because is a very specific requirement. I will see in the future if is better to load also this example in main branch.

ESP32 Ethernet OTA example

P.S. Compiling the SSLClient library with Arduino IDE takes a very long time. I recommend you to use VS Code which has a more effective caching mechanism.

woodlist commented 2 years ago

That's sound good, because you have all computational power needed. I've tried to take a look at the libraries for OTA update with ESP32 platform: unluckily ESP32 HTTPUpdate library is meant to be used only with WiFiClientor WiFiClientSecureclass.

In any case, this forcing does not arise from technical needs. In my opinion the developers have assumed that if there is WiFi no one needs to use an Ethernet connection, so @woodlist I have a good news for you ;) Just redefining methods of HTTPUpdateand HTTPClientlibraries (ad some others small things), you can use HTTPUpdateeven with EthernetClient througth SSLClientand IT WORKS like a charm!

Here you can find a working example (the same as for ESP8266, but adapted and tested for a NodeMCU-32S board and W5500 Ethernet shield). I've uploaded in dev branch, because is a very specific requirement. I will see in the future if is better to load also this example in main branch.

ESP32 Ethernet OTA example

P.S. Compiling the SSLClient library with Arduino IDE takes a very long time. I recommend you to use VS Code which has a more effective caching mechanism.

You're so honest. Thanks so much, dear!

woodlist commented 2 years ago

Finally I got a time for testing the sketch. It has been accommodated for GSM network usage. The Telegram connection test was passed successfully (local terminal report). The "welcome" interactive message reaches to the bot. But the actual update always falls, being treated as "File is unavailable. Maybe size limit 20MB was reached or file deleted".

woodlist commented 2 years ago

That's sound good, because you have all computational power needed. I've tried to take a look at the libraries for OTA update with ESP32 platform: unluckily ESP32 HTTPUpdate library is meant to be used only with WiFiClientor WiFiClientSecureclass.

In any case, this forcing does not arise from technical needs. In my opinion the developers have assumed that if there is WiFi no one needs to use an Ethernet connection, so @woodlist I have a good news for you ;) Just redefining methods of HTTPUpdateand HTTPClientlibraries (ad some others small things), you can use HTTPUpdateeven with EthernetClient througth SSLClientand IT WORKS like a charm!

Here you can find a working example (the same as for ESP8266, but adapted and tested for a NodeMCU-32S board and W5500 Ethernet shield). I've uploaded in dev branch, because is a very specific requirement. I will see in the future if is better to load also this example in main branch.

ESP32 Ethernet OTA example

P.S. Compiling the SSLClient library with Arduino IDE takes a very long time. I recommend you to use VS Code which has a more effective caching mechanism.

@cotestatnt Please, revert back the resource: https://github.com/cotestatnt/AsyncTelegram2/tree/dev/test/ESP32_OTA_password It is unavailable now.