Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.

Commit 633b31b

Browse files
authored
Update for v1.0.5
Add new features to enable : 1. configuring Portal Static IP address, Name and Password. 2. configuring Static IP address, Gateway, Subnet Mask and 2 DNS Servers IP addresses.
1 parent ece7ff4 commit 633b31b

File tree

16 files changed

+380
-54
lines changed

16 files changed

+380
-54
lines changed

README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ I'm inspired by [`EasyBlynk8266`] (https://github.com/Barbayar/EasyBlynk8266)
66

77
To help you to eliminate `hardcoding` your Wifi and Blynk credentials for ESP8266 and ESP32 (with / wwithout SSL), and updating/reflashing every time when you need to change them.
88

9+
With version v1.0.5 or later, you now can configure:
10+
11+
1. Config Portal Static IP address, Name and Password.
12+
2. Static IP address, Gateway, Subnet Mask and 2 DNS Servers IP addresses.
13+
914
### Installation
1015

1116
The suggested way to install is to:
@@ -87,6 +92,37 @@ After you connected, please, go to http://192.168.4.1.
8792

8893
Enter your credentials, then click `Save`. After you restarted, you will see your built-in LED turned OFF. That means, it connected to your Blynk server successfully.
8994

95+
The following is the sample terminal output when running example [ESP32WM_Config](examples/ESP32WM_Config)
96+
97+
```
98+
Starting ...
99+
[34] RFC925 Hostname = ESP32-WM-Config
100+
[46] Header = SSL_ESP32, SSID = ***, PW = ***
101+
[46] Server = account.duckdns.org, Port = 9443, Token = ***
102+
[47] Board Name = ESP32-WM-SSL-Config
103+
[50]
104+
___ __ __
105+
/ _ )/ /_ _____ / /__
106+
/ _ / / // / _ \/ '_/
107+
/____/_/\_, /_//_/_/\_\
108+
/___/ v0.6.1 on ESP32
109+
110+
[146] Use static IP
111+
[151] connectToWifi: start
112+
[402] connectToWifi: connected OK
113+
[402] IP = 192.168.2.230, GW = 192.168.2.1, SN = 255.255.255.0
114+
[402] DNS1 = 192.168.2.1, DNS2 = 8.8.8.8
115+
[403] begin: WiFi connected. Try connecting to Blynk
116+
[408] BlynkArduinoClient.connect: Connecting to account.duckdns.org:9443
117+
[3684] Certificate OK
118+
[3696] Ready (ping: 10ms).
119+
[3763] begin: WiFi and Blynk connected
120+
121+
Blynk ESP32 using EEPROM connected. Board Name : ESP32-WM-SSL-Config
122+
EEPROM size = 4096 bytes, EEPROM start address = 1024 / 0x400
123+
124+
```
125+
90126
This `Blynk.begin()` is not a blocking call, so you can use it for critical functions requiring in loop().
91127
Anyway, this is better for projects using Blynk just for GUI (graphical user interface).
92128

@@ -154,7 +190,7 @@ Please take a look at examples, as well.
154190
#define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET 5
155191
// Those above #define's must be placed before #include <BlynkSimpleEsp8266_WM.h>
156192
157-
#define USE_SSL true
193+
#define USE_SSL false
158194
159195
#if USE_SSL
160196
#include <BlynkSimpleEsp8266_SSL_WM.h>
@@ -164,6 +200,21 @@ Please take a look at examples, as well.
164200
165201
void setup()
166202
{
203+
....
204+
205+
// From v1.0.5
206+
// Set config portal SSID and Password
207+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
208+
// Set config portal IP address
209+
Blynk.setConfigPortalIP(IPAddress(192, 168, 220, 1));
210+
211+
// From v1.0.5, select either one of these to set static IP + DNS
212+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 230), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
213+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
214+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
215+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
216+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
217+
167218
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
168219
//Blynk.begin();
169220
// Use this to personalize DHCP hostname (RFC952 conformed)
@@ -176,6 +227,21 @@ void loop()
176227
Blynk.run();
177228
}
178229
```
230+
231+
### Releases v1.0.5
232+
233+
***Why this version***
234+
235+
Normally, the default Portal IP (192.168.4.1), SSID and PW as well as the dynamically allocated board's IP address are good enough.
236+
In special cases where there is conflict, if static IP is required or bad router's DNS settings, you can use the new features to force the configurable IP addresses. But please use with care to avoid potential issues.
237+
238+
***New in this version***
239+
240+
Add new features to enable :
241+
242+
1. configuring Portal Static IP address, Name and Password.
243+
2. configuring Static IP address, Gateway, Subnet Mask and 2 DNS Servers IP addresses.
244+
179245
### Releases v1.0.4
180246

181247
***Why this version***

examples/AM2315_ESP32_SSL/AM2315_ESP32_SSL.ino

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.4
10+
* Version: 1.0.5
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -23,6 +23,7 @@
2323
* 1.0.1 K Hoang 28/10/2019 Add features
2424
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
2525
* 1.0.4 K Hoang 07/01/2020 Use configurable personalized RFC-952 DHCP hostname in Blynk_WM v1.0.4
26+
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2627
*****************************************************************************************************************************/
2728

2829
#ifndef ESP32
@@ -182,6 +183,20 @@ void setup()
182183
}
183184

184185
#if USE_BLYNK_WM
186+
187+
// From v1.0.5
188+
// Set config portal SSID and Password
189+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
190+
// Set config portal IP address
191+
Blynk.setConfigPortalIP(IPAddress(192, 168, 200, 1));
192+
193+
// From v1.0.5, select either one of these to set static IP + DNS
194+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
195+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
196+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
197+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
198+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
199+
185200
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
186201
//Blynk.begin();
187202
// Use this to personalize DHCP hostname (RFC952 conformed)

examples/AM2315_ESP8266/AM2315_ESP8266.ino

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.4
10+
* Version: 1.0.5
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -23,6 +23,7 @@
2323
* 1.0.1 K Hoang 28/10/2019 Add features
2424
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
2525
* 1.0.4 K Hoang 07/01/2020 Use configurable personalized RFC-952 DHCP hostname in Blynk_WM v1.0.4
26+
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2627
*****************************************************************************************************************************/
2728

2829
#ifndef ESP8266
@@ -181,6 +182,19 @@ void setup()
181182
}
182183

183184
#if USE_BLYNK_WM
185+
// From v1.0.5
186+
// Set config portal SSID and Password
187+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
188+
// Set config portal IP address
189+
Blynk.setConfigPortalIP(IPAddress(192, 168, 200, 1));
190+
191+
// From v1.0.5, select either one of these to set static IP + DNS
192+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
193+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
194+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
195+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
196+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
197+
184198
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
185199
//Blynk.begin();
186200
// Use this to personalize DHCP hostname (RFC952 conformed)

examples/DHT11ESP32/DHT11ESP32.ino

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.4
10+
* Version: 1.0.5
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -23,6 +23,7 @@
2323
* 1.0.1 K Hoang 28/10/2019 Add features
2424
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
2525
* 1.0.4 K Hoang 07/01/2020 Use configurable personalized RFC-952 DHCP hostname in Blynk_WM v1.0.4
26+
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2627
*****************************************************************************************************************************/
2728

2829
#ifndef ESP32
@@ -124,6 +125,19 @@ void setup()
124125
Serial.println("\nStarting ...");
125126

126127
dht.begin();
128+
129+
// From v1.0.5
130+
// Set config portal SSID and Password
131+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
132+
// Set config portal IP address
133+
Blynk.setConfigPortalIP(IPAddress(192, 168, 200, 1));
134+
135+
// From v1.0.5, select either one of these to set static IP + DNS
136+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
137+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
138+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
139+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
140+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
127141

128142
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
129143
//Blynk.begin();

examples/DHT11ESP32_SSL/DHT11ESP32_SSL.ino

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.4
10+
* Version: 1.0.5
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -23,6 +23,7 @@
2323
* 1.0.1 K Hoang 28/10/2019 Add features
2424
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
2525
* 1.0.4 K Hoang 07/01/2020 Use configurable personalized RFC-952 DHCP hostname in Blynk_WM v1.0.4
26+
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2627
*****************************************************************************************************************************/
2728

2829
#ifndef ESP32
@@ -125,6 +126,19 @@ void setup()
125126
Serial.println("\nStarting ...");
126127

127128
dht.begin();
129+
130+
// From v1.0.5
131+
// Set config portal SSID and Password
132+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
133+
// Set config portal IP address
134+
Blynk.setConfigPortalIP(IPAddress(192, 168, 200, 1));
135+
136+
// From v1.0.5, select either one of these to set static IP + DNS
137+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
138+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
139+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
140+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
141+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
128142

129143
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
130144
//Blynk.begin();

examples/DHT11ESP8266/DHT11ESP8266.ino

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.4
10+
* Version: 1.0.5
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -23,6 +23,7 @@
2323
* 1.0.1 K Hoang 28/10/2019 Add features
2424
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
2525
* 1.0.4 K Hoang 07/01/2020 Use configurable personalized RFC-952 DHCP hostname in Blynk_WM v1.0.4
26+
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2627
*****************************************************************************************************************************/
2728

2829
#ifndef ESP8266
@@ -123,7 +124,20 @@ void setup()
123124
Serial.println("\nStarting ...");
124125

125126
dht.begin();
126-
127+
128+
// From v1.0.5
129+
// Set config portal SSID and Password
130+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
131+
// Set config portal IP address
132+
Blynk.setConfigPortalIP(IPAddress(192, 168, 200, 1));
133+
134+
// From v1.0.5, select either one of these to set static IP + DNS
135+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
136+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
137+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
138+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
139+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
140+
127141
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
128142
//Blynk.begin();
129143
// Use this to personalize DHCP hostname (RFC952 conformed)

examples/DHT11ESP8266_Debug/DHT11ESP8266_Debug.ino

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
88
* Built by Khoi Hoang https://github.com/khoih-prog/Blynk_WM
99
* Licensed under MIT license
10-
* Version: 1.0.4
10+
* Version: 1.0.5
1111
*
1212
* Original Blynk Library author:
1313
* @file BlynkSimpleEsp8266.h
@@ -23,6 +23,7 @@
2323
* 1.0.1 K Hoang 28/10/2019 Add features
2424
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
2525
* 1.0.4 K Hoang 07/01/2020 Use configurable personalized RFC-952 DHCP hostname in Blynk_WM v1.0.4
26+
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2627
*****************************************************************************************************************************/
2728

2829
#ifndef ESP8266
@@ -126,7 +127,20 @@ void setup()
126127
Serial.println("\nStarting ...");
127128

128129
dht.begin();
129-
130+
131+
// From v1.0.5
132+
// Set config portal SSID and Password
133+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
134+
// Set config portal IP address
135+
Blynk.setConfigPortalIP(IPAddress(192, 168, 200, 1));
136+
137+
// From v1.0.5, select either one of these to set static IP + DNS
138+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
139+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
140+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
141+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
142+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
143+
130144
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
131145
//Blynk.begin();
132146
// Use this to personalize DHCP hostname (RFC952 conformed)

examples/DHT11ESP8266_SSL/DHT11ESP8266_SSL.ino

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* 1.0.1 K Hoang 28/10/2019 Add features
2424
* 1.0.2 K Hoang 21/11/2019 Fix bug. Add features.
2525
* 1.0.4 K Hoang 07/01/2020 Use configurable personalized RFC-952 DHCP hostname in Blynk_WM v1.0.4
26+
* 1.0.5 K Hoang 20/01/2020 Add configurable static IP, GW, SN, DNS1, DNS2 and Config Portal static IP and Credentials
2627
*****************************************************************************************************************************/
2728

2829
#ifndef ESP8266
@@ -126,7 +127,20 @@ void setup()
126127
Serial.println("\nStarting ...");
127128

128129
dht.begin();
129-
130+
131+
// From v1.0.5
132+
// Set config portal SSID and Password
133+
Blynk.setConfigPortal("TestPortal", "TestPortalPass");
134+
// Set config portal IP address
135+
Blynk.setConfigPortalIP(IPAddress(192, 168, 200, 1));
136+
137+
// From v1.0.5, select either one of these to set static IP + DNS
138+
Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
139+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
140+
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
141+
//Blynk.setSTAStaticIPConfig(IPAddress(192, 168, 2, 220), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
142+
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));
143+
130144
// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
131145
//Blynk.begin();
132146
// Use this to personalize DHCP hostname (RFC952 conformed)

0 commit comments

Comments
 (0)