Comments (13)
Hi, just wanted to share how I set my WM up. I hard coded the blynk-cloud.com server, port 80 and other fields as hidden input fields and updated the css.
from blynk_wm.
@kevinleberge
Again thanks for using the library and helping to locate the bugs. The library is getting better everyday thanks to contributing users like you.
For the record, the fix is as follows and will reflect in the release.
#if (USE_WM && USE_DYNAMIC_PARAMETERS)
// UPDATE DYNAMIC PARAMETERS
// 1 - CONVERTS THE char INFO FROM THE CONFIG PORTAL OR COMPILER CONSTANTS TO THE int VALUES THEY NEED TO BE FOR USE IN A SKETCH
// 2 - UPDATES BLYNK WITH OTHER DYNAMIC PARAMETERS (WIDGET LABELS)
void updateDynamicParameters()
{
....
} // end updateDynamicParameters
#endif // (updateDynamicParameters not needed if NOT USE_WM)
// BLYNK_CONNECTED GETS CALLED WHEN CONNECTING TO BLYNK SERVERS
// GETS CALLED IMMEDIATELY ON FIRST CONNECT TO BLYNK SERVER, TOO
BLYNK_CONNECTED()
{
Serial.println ( "\nBLYNK_CONNECTED..." );
#if (USE_WM && USE_DYNAMIC_PARAMETERS)
// Convert the Config Portal (or compiler constant) Virtual Pin char values to Blynk-usable ints
updateDynamicParameters();
#endif
} // end BLYNK_CONNECTED
from blynk_wm.
I have absolutely no problem testing I am so grateful to be able to support this.
from blynk_wm.
@kevinleberge
There are more libraries in My Repository
You're very welcome to use, test and locate the bugs if you're interested.
The USE_DEFAULT_CONFIG_DATA
bug is still present in many relating libraries and will be fixed gradually.
Regards,
from blynk_wm.
from blynk_wm.
@kevinleberge
Your help will be greatly welcome. You know there is so much a single guy can do.
Regards,
from blynk_wm.
@kevinleberge
That's so nice. It'll be great if you can share with us how you can do that. Even post your new example here in this repository.
from blynk_wm.
Hi @khoih-prog
Hi @kevinleberge
Here is my code and simple instructions for creating and using a couple of library files to free me from hard-coding credentials in my sketches.
For this first round with the .h library files, I have included the text for my two files.
@khoih-prog , may I ask that you post these in the right place? I'm also putting them on my own Github page.
After this initial placement, I can maintain them on the official WM repository as needed.
Thanks in advance.
MY_WIFI_CREDENTIALS.h
/* MY_WIFI_CREDENTIALS.h
*
* Even if you use only one SSID/WiFiPassword, you may wish to keep it in a central place, out of your code.
*
* A simple way to manage SSIDs and WiFiPasswords you may wish to use...
* * Put your WiFi credentials in a file you can #include in your Arduino sketches.
* * Use a simple label like MY_SSID and MY_WIFI_PASSWORD in your code.
*
* Here's how...
* * Create a new folder called MY_WIFI_CREDENTIALS in the Arduino/libraries folder
* * Create a new text file named MY_WIFI_CREDENTIALS.h
* (Same as as the folder. The .h is important.)
*
* * Use this as a template.
* * Edit in your own WiFi SSID(s) and WiFi Password(s)
*/
// #include "MY_WIFI_CREDENTIALS.h" // #defines MY_WIFI_SSID AND MY_WIFI_PASSWORD
#define MY_WIFI_SSID "Serengeti" // network SSID (name)
#define MY_WIFI_PASSWORD "hey-this is secret 9897%%&" // network password
/* Comment out the credentials you do not use as regularly...
#define MY_WIFI_SSID "Virus-Vault" // network SSID (name)
#define MY_WIFI_PASSWORD "TwoFourSixEight2468!" // network password
#define MY_WIFI_SSID "MyAndroidPhone" // network SSID (name)
#define MY_WIFI_PASSWORD "AndroidPassword66$" // network password
*/
/*
* * With the library file in place, restart your Arduino IDE.
* * In each Arduino sketch, add the line
* #include "MY_WIFI_CREDENTIALS.h" // Use quotes " here.
* * Write each sketch to use MY_SSID and MY_WIFI_PASSWORD throughout the sketch
* * Compile and go
*
* This way,
* * All your WiFi credentials are in one place where you can keep track of them.
* * You are not hard-coding passwords in your sketches.
* * You Arduino code becomes more portable because all sketches use MY_WIFI_CREDENTIALS.
* * If you ever have to publish your code, your WiFi Credentials are not visible to everyone.
* * You will be happier in life.
*/
MY_BLYNK_CREDENTIALS.h
/* MY_BLYNK_CREDENTIALS.h
*
* Since Blynk requires a different Blynk Authcode for every device on every Blynking panel,
* I end up with a lot of Blynking Authcodes.
*
* A simple way to manage all the Blynk Authcodes you will likely generate...
* * Put them all in a library file you can #include in your Arduino sketches.
* * Name each of the Blynk Authcodes with a helpful name.
* * Select the right Blynk Authcode in each sketch without having to hard-code it.
*
* Here's how...
* * Create a new folder called MY_BLYNK_CREDENTIALS in your Arduino/libraries folder
* * Create a new text file named MY_BLYNK_CREDENTIALS.h
* (Same as as the folder. The .h is important.)
*
* * Use this as a template.
* * Edit in your own Blynk Authcodes with descriptive names for each of your projects or devices
*/
#define MY_BLYNK_SERVER "blynk-cloud.com" // You may or may not need this depending on your code
// From my Blynk Panel 1 ( 3 devices )
#define MY_EXTERIOR_TEMP_AUTHCODE "wtxxxxxxxxxxxxxxxxxxxxxxxxxxxxBS" // Use your real Blynk Authcode here
#define MY_AC_DEV_AUTHCODE "fnyyyyyyyyyyyyyyyyyyyyyyyyyyyy7t" // Use your real Blynk Authcode here
#define MY_BARO_AUTHCODE "_YzzzzzzzzzzzzzzzzzzzzzzzzzzzzRP" // Use your real Blynk Authcode here
//From my Blynk Panel 2 ( 2 devices )
#define MY_IFTTT_DEMO_AUTHCODE "_cbbbbbbbbbbbbbbbbbbbbbbbbbbbbsi" // Use your real Blynk Authcode here
#define MY_SONOFF_DEV_AUTHCODE "HWcccccccccccccccccccccccccccc7K" // Use your real Blynk Authcode here
//From my Blynk Panel 3 ( 1 device )
#define MY_REAL_SONOFF_AUTHCODE "Geddddddddddddddddddddddddddddqc" // Use your real Blynk Authcode here
/*
* * Once this library file is in place, restart your Arduino IDE.
* * In each Arduino sketch, add the line
* #include "MY_BLYNK_AUTHCODES.h" // Use quotes " here.
* * In all your sketches write something like
* #define MY_BLYNK_AUTHCODE MY_BARO_AUTHCODE //from your .h file.
* * Write each sketch to use MY_BLYNK_AUTHCODE throughout the sketch
* instead of a hard-coded Blynk Authcode.
* * Right after the #include "MY_BLYNK_AUTHCODES.h" statement, write a #define command to choose the
* correct Blynk Authcode.
* * Compile and go
*
* This way,
* * All Blynk Authcodes are in one place where you can keep track of them.
* * You are not hard-coding Blynk Authcodes in your sketches.
* * You Arduino code becomes more portable because all sketches use MY_BLYNK_AUTHCODE.
* * If you ever have to publish your code, your Blynk Authcodes are not visible to everyone.
* * You will be happier in life.
*/
from blynk_wm.
from blynk_wm.
Forgive my ignorance, why are you hard coding the data if the WM handles writing the details through a config portal to the eeprom?
No, your question is good one in normal use case, with USE_DEFAULT_CONFIG_DATA == false
I think @thorathome way to hardcode is just used in developing stage, with USE_DEFAULT_CONFIG_DATA == true
, so that we don't have to use WM's Config Portal every time (CP) to enter the Credentials, and save us a lot of time to enter CP, copy and paste the info.
In normal use case, just use a dummy info is good enough. Credentials will get from CP, if necessary.
from blynk_wm.
So true. So true @khoih-prog
Plus, Old Habits Die Hard! #OldHabitsDieHard @kevinleberge asks the right question. No need to hard-code any of this info in the code anymore.
from blynk_wm.
No need to hard-code any of this info in the code anymore.
Not absolutely necessary, but very helpful in many cases, especially with the latest USE_DEFAULT_CONFIG_DATA
implementation
-
For the first time, use hardcoded Credentials in those files to have Credentials loaded and saved in LittleFS/SPIFFS/EEPROM. This way will save us time to input them via CP, certainly with
USE_DEFAULT_CONFIG_DATA == true
-
Then with
USE_DEFAULT_CONFIG_DATA == false
, we don't need to use CP, yet having all the Credentials ready to work. -
Now, we can delete and use dummy Credentials files' info. Still keep the dummy files or get errors in compiling.
from blynk_wm.
Here is my code and simple instructions for creating and using a couple of library files to free me from hard-coding credentials in my sketches.
For this first round with the .h library files, I have included the text for my two files.
@khoih-prog , may I ask that you post these in the right place? I'm also putting them on my own Github page.
After this initial placement, I can maintain them on the official WM repository as needed.
Already updated
from blynk_wm.
Related Issues (16)
- Compilation error on ESP8266WM_Config.ino example HOT 4
- blynk port HOT 1
- Changing settings in example sketch doesn't reflect on device HOT 2
- Can’t load defaults HOT 18
- Compiling errors HOT 2
- AP stays open HOT 2
- COMPILING ERROR AFTER UPDATE HOT 3
- Auto-reconnect to Blynk HOT 2
- HowToUse_SSL_LocalBlynkServer.md fine tuning HOT 1
- Blynk WM failes while setting the password.
- Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address HOT 1
- How to trigger a Config Portal from code HOT 13
- Writing/updating ConfigPortal values from code HOT 5
- Good new feature: Blynk.resetAndEnterConfigPortal() Thanks & question HOT 10
- No save the char # at end of the wifi password HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blynk_wm.