khoih-prog / Blynk_Async_WM

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.
MIT License
20 stars 8 forks source link

Using Private Blynk server in SSL mode #1

Closed balucio closed 3 years ago

balucio commented 3 years ago

Hi, how could I use your library with Private SSL Blynk Server? For my installation I use Let's Encrypt Certificate.

khoih-prog commented 3 years ago

Hi,

I just retest and be sure the SSL connection to local Blynk Server, using this Blynk_Async_WM Library is still OK.

Just using the Async_ESP32WM_Config example

The terminal output and the screen shot is are as follows:

Config Portal Screen Shot

Selection_599

2. Terminal Output

Starting Async_ESP32WM_Config using SPIFFS with SSL on ESP32_DEV
[221] Hostname=ESP32-Async-Controller
[265] LoadCfgFile 
[265] OK
[265] ======= Start Stored Config Data =======
[265] Hdr=SSL_ESP32,BrdName=ESP32_SSL_Async
[265] SSID=HueNet1,PW=12345678
[267] SSID1=HueNet2,PW1=12345678
[270] Server=account.duckdns.org,Token=token1
[276] Server1=account.duckdns.org,Token1=token2
[283] Port=9443
[284] ======= End Config Data =======
[288] CCSum=0x3658,RCSum=0x3658
[291] LoadCredFile 
[292] CrR:pdata=mqttpserver,len=34
[295] CrR:pdata=1883,len=6
[298] CrR:pdata=mwtt-user,len=34
[301] CrR:pdata=mqtt-pass,len=34
[304] CrR:pdata=mqtt_Subs,len=34
[307] CrR:pdata=mqtt_Pubs,len=34
[310] OK
[310] CrCCsum=0x1484,CrRCsum=0x1484
[314] Valid Stored Dynamic Data
[317] Hdr=SSL_ESP32,BrdName=ESP32_SSL_Async
[320] SSID=HueNet1,PW=12345678
[323] SSID1=HueNet2,PW1=12345678
[326] Server=account.duckdns.org,Token=token1
[332] Server1=account.duckdns.org,Token1=token2
[339] Port=9443
[340] ======= End Config Data =======
[344] bg: noConfigPortal = true
[346] Connecting MultiWifi...
[6703] WiFi connected after time: 1
[6703] SSID: HueNet1, RSSI = -39
[6703] Channel: 2, IP address: 192.168.2.101
[6703] bg: WiFi OK. Try Blynk
[6705] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP32

[7718] NTP time: Mon Nov  9 16:55:33 2020
[7718] BlynkArduinoClient.connect: Connecting to account.duckdns.org:9443
[9595] Certificate OK
[9603] Ready (ping: 7ms).
[9672] Connected to Blynk Server = account.duckdns.org, Token = token1
[9672] bg: WiFi+Blynk OK
Blynk ESP32 using SPIFFS connected. Board Name : ESP32_SSL_Async
Your stored Credentials :
MQTT Server = mqtt-server
Port = 1883
MQTT UserName = mqtt-user
MQTT PWD = mqtt-pass
Subs Topics = mqtt_Subs
Pubs Topics = mqtt_Pubs
RBRBRB

3. HOWTO

  1. To connect, you certainly have to install your Server, with appropriate SST Certificate. Follow instruction in Blynk, as well as in

HowToUse_SSL_LocalBlynkServer

  1. Also follow the instructions in

Installation for Arduino IDE

especially

4. COPY the /certs files from the main Blynk library to the Blynk_Async_WM library. 
   * **Find the `Blynk/src/certs` library directory.** (This is in the main Blynk library, may be named differently.)
   * **Find the `Blynk_Async_WM/src/certs` library directory.** (This is in the installed Blynk_Async_WM library, may be named differently.) Using Arduino IDE, these directories are normally found under .../Arduino/Sketchbook/libraries or .../Arduino/libraries. 
      * *(Sometimes Arduino IDE names a library folder with an unhelpful name like Arduino_12345. You can safely rename that folder under …/libraries/ to a compliant name like Blynk_Async_WM for convenience. Remember to exit and restart IDE after renaming any library directory.)*
   * **COPY (do not cut and paste) the entire contents** of the `Blynk/src/certs` directory to the `Blynk_Async_WM/src/certs` directory.
      * *(FYI: the reason for copying the certs from the Blynk library to Blynk_Async_WM library is so that Blynk_Async_WM will have access to Blynk's SSL certificates. And you almost certainly want to be using SSL!)*
  * **You must do Step 4 each time you update the Blynk_Async_WM library** to keep those SSL certs accessible. 

That's all I can help you. You have to do your homework and successfully install and test the SSL Local Sever first, with normal Blynk SSL sketches, to make sure it's working .

For example

Do some research / search as well as ask for support in Blynk Forum about how to install SSL Local Server.

Good Luck,