GithubHelp home page GithubHelp logo

khoih-prog / blynk_async_wm Goto Github PK

View Code? Open in Web Editor NEW
20.0 3.0 8.0 1.23 MB

Simple WiFiManager for Blynk and ESP8266/ESP32 (including ESP32-S2, ESP32-C3) with or without SSL, configuration data saved in either LittleFS, SPIFFS or EEPROM. This library, using AsyncWebServer instead of (ESP8266)WebServer, for configuring/auto(re)connecting ESP8266/ESP32 modules to best or available MultiWiFi APs and MultiBlynk servers at runtime. Enable adding dynamic custom parameters from sketch and input using the same Config Portal. Config Portal will be auto-adjusted to match the number of dynamic parameters. Optional default Credentials to be autoloaded into Config Portal to use or change instead of manually input. Static STA IP and DHCP Hostname as well as Config Portal AP channel, IP, SSID, Password can be configured. Multi or Double DetectDetector feature permits entering Config Portal as requested.

License: MIT License

C++ 98.64% C 1.36%
esp32 esp8266 blynk blynk-server blynk-library multiwifi multiblynk async asyncwebserver ssl

blynk_async_wm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

blynk_async_wm's Issues

custom Blynk port not working for BlynkSimpleEsp32_Async_WM.h

Describe the bug

Custom blynkport from Credentials.h is not being used, instead it looks like the hard coded value is.
This work fine for ESP8266 but not ESP32. The code looks different.

Steps to Reproduce

Blynk port changed to 8082 in Credentials.h

Expected behavior

Blynk should connect to on 8082.

Actual behavior

Blynk tries to connect to port 8080.

`
//existing line 2068 in BlynkSimpleEsp32_Async_WM.h
BlynkESP32_WM_config.Blynk_Creds[i].blynk_server, BLYNK_SERVER_HARDWARE_PORT);

//works if I change to this
BlynkESP32_WM_config.Blynk_Creds[i].blynk_server, BlynkESP32_WM_config.blynk_port);`

The above change seems consistent with the ESP8266 file which does work properly.

Code stop when wifi loss

Describe the bug

Code stop when wifi loss

Steps to Reproduce

Launch Portal Ok
Connect to wifi OK
Connect to Blynk server OK
loop() code run fine
but
if wifi loss the device enter some reconnect mode that not run main code, so, is too dependent of wifi.
may be i´m do something wrong

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

A clear and concise description of what you expected to happen.

Debug and AT-command log (if applicable)

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Information

Please ensure to specify the following:

  • Arduino IDE version (e.g. 1.8.13) or Platform.io version
  • ESP8266,ESP32 or STM32 Core Version (e.g. ESP8266 core v2.7.4, ESP32 v1.0.5 or STM32 v1.9.0)
  • Contextual information (e.g. what you were trying to achieve)
  • Simplest possible steps to reproduce
  • Anything that might be relevant in your opinion, such as:
    • Operating system (Windows, Ubuntu, etc.) and the output of uname -a
    • Network configuration

Example

Arduino IDE version: 1.8.13
ESP32 Core Version 1.0.5
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-66-generic #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Context:
I encountered an endless loop while trying to connect to Local WiFi.

Steps to reproduce:
1. ...
2. ...
3. ...
4. ...

Additional context

Add any other context about the problem here.

Minimize blocking during multi-wifi reconnect

Is your feature request related to a problem? Please describe.

ESP8266

If wifi is lost, the device will wait CONFIG_TIMEOUT until attempting a reconnect. The reconnect (connectMultiWifi) attempts to reconnect a hard coded 10 times (with ~3 second delays).

The problem that I have for a remote IOT device (PID temperature controller, 1 second sampling frequency) is that the reconnect attempts are blocking. the amount of time stuck in reconnect can be significant (at least 60 seconds for minimum 2 reconnect attempts + 30second connect attempt after reset).

Describe the solution you'd like

I'd like the reconnect attempts (connectMultiWifi) to be adjustable (or less) to limit time spent blocking main loop. Currently this is hardcoded.

Describe alternatives you've considered

changing specific hardcoded attempts to a define.

Additional context

Add any other context or screenshots about the feature request here.

Sending JSON Data to async Server using SPIFFS and Blynk_Async_WM library

Not an issue but a support
Today my application is running fine with Blynk and WebServer for ESP32
I can see a huge benefit in term of reliability to use your Blynk_Async_WM library (mainly autoconnect/autoreconnect of WiFi/Blynk). My understanding is that this library is compliant only with AsyncWebServer
Here is the program extract related to Webserver with RTOS mutitask (thank you for your example Async_ESP32_MultiTask.ino), can you help to convert with AsyncWebServer ? (I tried without success !!)
Thank you

//******************************************************************************************************************************
#include <Arduino.h>
#include <WebServer.h>
WebServer server (81);

String json_grid;

void sendGrid() {
server.send(200, "application/json", json_grid); // send json_grid values
}

void handle_NotFound(){
server.send(404, "text/plain", "Not found");
}

void BlynkRun( void * pvParameters ) // essential housekeeping command that keeps the background Blynk library “running”.
{
#define BLYNK_RUN_INTERVAL_MS 250L

for (;;)
{
Blynk.run(); // SYNC BLYNK
client.loop(); // SYNC MQTT

vTaskDelay(BLYNK_RUN_INTERVAL_MS / portTICK_PERIOD_MS);

}
}

void ServerRun( void * pvParameters ) // monitors the presence of a client and delivers the requested HTML page
{
#define SERVER_RUN_INTERVAL_MS 2000L

for (;;)
{
server.handleClient(); // SYNC SERVER

vTaskDelay(SERVER_RUN_INTERVAL_MS / portTICK_PERIOD_MS);

}
}

//***** setup******//
xTaskCreatePinnedToCore(BlynkRun, "BlynkRun", 50000, NULL, BlynkRun_Priority, NULL, USING_CORE_2);
xTaskCreatePinnedToCore(ServerRun, "ServerRun", 50000, NULL, ServerRun_Priority, NULL, USING_CORE_2);

SPIFFS.begin();

server.on("/grid.json", sendGrid); // sendGrid() send grid.json in javascript file $.getJSON('/wes.json', function(data))
server.onNotFound(handle_NotFound);

server.serveStatic("/js", SPIFFS, "/js"); // Makes index page and images available
server.serveStatic("/css", SPIFFS, "/css");
server.serveStatic("/png", SPIFFS, "/png");
server.serveStatic("/", SPIFFS, "/index.html");
server.begin();
//*****************//

void loop() {
process_data(); // process data for json_grid. Main code USING_CORE_1
}
//******************************************************************************************************************************

On ESP01-S 1M Serial does not working

Hi,
currenly I testing your great library on an ESP-01S.
I initialize the serial interface at begin of setup(), the I call the setupPortal function to configure the Blynk_Async_WM library with default parameters. After the setup the serial interface does not work anymore, i.e. Serial.print does not print anything.
Please note that same code works perfectly on other ESP Boards as the Wemos D1 mini.

void setup() {
  Serial.begin(APP_SERIAL_SPEED);
   while (!Serial);
   Serial.println("Inizio Setup");

   setupPortal();

  // From here the Serial does not work
 ...
}

void setupPortal() {
  
  // Setup WLAN and Blynk
    Serial.println("Setup portal");

  String config_portal_pass(HOSTNAME);
  String config_portal_ssid(HOSTNAME);

  Blynk.setConfigPortal( config_portal_ssid, config_portal_pass);
  Blynk.setConfigPortalIP ( IPAddress ( CONFIG_PORTAL_IPADDRESS ) );
  Blynk.setConfigPortalChannel(0);
  Blynk.begin(Blynk.getBoardName().c_str()); // DHCP (router) device name
  WiFi.hostname(Blynk.getBoardName());
}

In order to have the serial working again I need to reset It using:

    delay(500);
    Serial.end();
    Serial.begin(APP_SERIAL_SPEED);
    // Now Serial.print works...

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.