Accessing Blynk 2.0 Wi-Fi Credentials

Hello, I have a project where I need to access a database while using Blynk 2.0, so I need to know the Wi-Fi credentials stored inside the ESP32 by the Blynk library, is there anyway to do that?
Or is there even a better way to do what I am trying to do?
I just need a database to write some data and potentially read some data, can I even do this with Blynk 2.0?

Thank you.

I think you’ll need to explain in more detail.

I can’t see any reason why you would need the WiFi credentials to access a database, unless your intention is to write these credentials into that database.

And, if you do need to access these credentials the solution may be different depending on whether you’re using Edgent or static provisioning.

Pete.

Sure, no problems, I will explain in more details.

The reason I need the Wi-Fi credentials is because the database library (as far as I understand) requires internet connection to be established first to access the database and read/write data.

I am using the Edgent along with the mobile application and can re-do the provisioning anytime, and no problems in that side at all, actually it is running perfectly.

So now let me rephrase my question(s) once again

  1. How do I gain access by code to the Wi-Fi credentials stored by Edgent?
  2. Would using the database library interfere with Blynk 2.0 library in anyway?
    I will be using core 0 for both the Blynk data writing to mobile application and the database.
  3. Is there a better way of doing this, like does Blynk have a database that I can use and also access it through my PC?

The WiFi credential are used to establish your internet connection. Once that connection is created you can use it for other thigs - such as reading/writing data to databases or making API calls to other services. Of course this has to be handled in a way that won’t interfere with the communication between te device and the Blynk server.

You cannot create another WiFi connection from your device to handle communication with a database, your board wont support concurrent WiFi connections.

Without knowing more about how this “database” will be used, the type of data it will store, the frequency of updates, what type of access you need from your PC etc, it’s difficult to comment further.
At the moment it’s far too hypothetical.

Pete.

Aright, allow me to take more of your time and provide more details as needed.

I am planning on using Firebase DB or InfluxDB, however, I don’t really know the difference yet and did not look into it as of right now.

I am building a power meter and its working fine and I am uploading voltage, current, PF and power consumption values to the Blynk mobile application.

Since I am using ESP32, I utilize Core 0 for Blynk functions (and later on for the database functions as well), as they are be mostly blocking functions.
And Core 1 for the system itself.

Type of data: float
Frequency of storage: 1 value of each parameter every 1 minute
Type of access needed from PC: read data (perhaps write BUT can be disregarded)

Sorry for not posting all these details at the beginning, I thought it was irrelevant and I was wrong :slight_smile:

Okay, so it’s clear that you don’t need the WiFi credentials.
I guess the simplest solution would be to use the API for FireBase or Influx and write the data to that directly from the sketch.

Pete.

Well, assuming that the API does not need to connect to the internet in a specific way, yes.
For the record, I thought I needed the Wi-Fi credentials because the API would not follow that assumption.
Anyways, I am not the expert here, I will try it and will get back here once I do (maybe a month later).

Thank you for your time, efforts and quick responses.

You’ll use the ESP32 HTTPClient.h library and piggy-back off of the existing internet connection.

Be sure to close your HTTPClient session with an [HTTPClient object name].end() command after using .PUT or .GET command to upload your data to the database.

Pete.

1 Like

BTW, if anyone comes to this topic because they do have a genuine need to access the WiFi credentials when using Edgent then take a look at the ConfigStore.h tab and you’ll see how this data is stored.

Pete.

1 Like