GithubHelp home page GithubHelp logo

dmitry-sukhoruchkin / asyncelegantota Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ayushsharma82/asyncelegantota

0.0 0.0 0.0 1.43 MB

Perform OTAs for ESP8266 / ESP32 Elegantly! Uses AsyncWebServer

License: MIT License

Shell 0.12% C++ 2.88% Python 0.84% C 96.16%

asyncelegantota's Introduction


     


Perform OTAs for ESP8266 & ESP32 Asynchronously

AsyncElegantOTA provides a beautiful interface to upload Over the Air `.bin` updates to your ESP Modules with precise status and progress displayed over UI. This Library shows the current upload progress of your OTA and once finished, it will display the status of your OTA. This Version of Library uses AsyncWebServer. Thanks to @me-no-dev for a wonderful webserver library.



Preview



How to Install

Directly Through Arduino IDE ( Currently Submitted for Approval. Use Mannual Install till it gets Approved.)

Go to Sketch > Include Library > Library Manager > Search for "AsyncElegantOTA" > Install

Manual Install

For Windows: Download the Repository and extract the .zip in Documents>Arduino>Libraries>{Place "ElegantOTA" folder Here}

For Linux: Download the Repository and extract the .zip in Sketchbook>Libraries>{Place "ElegantOTA" folder Here}

Manually through IDE

Download the Repository, Go to Sketch>Include Library>Add .zip Library> Select the Downloaded .zip File.


Documentation

AsyncElegantOTA is a dead simple library which does your work in just 1 Line. Honestly, It's just a wrapper library which injects it's own elegant webpage instead of the ugly upload page which comes by default in Arduino Library.

Include AsyncElegantOTA Library #include <AsyncElegantOTA.h> at top of your Arduino Code.

Paste this - AsyncElegantOTA.begin(&server); line above your server.begin();

That's all!

Now copy the IPAddress displayed over your Serial Monitor and go to http://<IPAddress>/update in browser. ( where <IPAddress> is the IP of your ESP Module)


Additional Security:

If you would like to add login to your OTA webpage, then please replace AsyncElegantOTA.begin(&server); with AsyncElegantOTA.begin(&server, "username", "password");. This will prevent unauthorized requests to your OTA webpage and prevent unauthorized firmware upload to your MCU.


Antivirus Issue: If you have an antivirus on your PC with internet security, the progress bar on webpage will instantly show 100% because of request caching by your antivirus software. There is no fix for this unless you want to disable your antivirus or whitelist your local IP addresses in it. ( Same is the case with iOS, safari will cache the outgoing requests )


Tutorials

Tutorials for AsyncElegantOTA is live on RandomNerdTutorials.

ESP8266

Arduino IDE:

https://randomnerdtutorials.com/esp8266-nodemcu-ota-over-the-air-arduino/

PlatformIO (manual method):

https://randomnerdtutorials.com/esp8266-nodemcu-ota-over-the-air-vs-code/


ESP32

Arduino IDE:

https://randomnerdtutorials.com/esp32-ota-over-the-air-arduino/

PlatformIO (manual method):

https://randomnerdtutorials.com/esp32-ota-over-the-air-vs-code/


PlatformIO Automatic Method

  • Copy the file "platformio_upload.py" from this repository into the same folder as your platformio.ini file
  • Set the upload method for your project in platformio.ini:
extra_scripts = platformio_upload.py
upload_protocol = custom
upload_url = <your upload URL, such as http://192.168.1.123/update>

Examples

For ESP8266:

#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>

const char* ssid = "........";
const char* password = "........";

AsyncWebServer server(80);


void setup(void) {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
    request->send(200, "text/plain", "Hi! I am ESP8266.");
  });

  AsyncElegantOTA.begin(&server);    // Start ElegantOTA
  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
}


For ESP32:

#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>

const char* ssid = "........";
const char* password = "........";

AsyncWebServer server(80);


void setup(void) {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
    request->send(200, "text/plain", "Hi! I am ESP32.");
  });

  AsyncElegantOTA.begin(&server);    // Start ElegantOTA
  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
}



Contributions

Every Contribution to this repository is highly appriciated! Don't fear to create pull requests which enhance or fix the library as ultimatly you are going to help everybody.

If you want to donate to the author then you can buy me a coffee, It really helps me keep these libraries updated:



License

ESP-DASH is licensed under MIT.

asyncelegantota's People

Contributors

ayushsharma82 avatar sui77 avatar qistoph avatar dushyantahuja avatar freestila avatar joostab avatar lukepalmer avatar smford avatar manhere avatar mrdc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.