Migrating from using Blynk.begin(auth,.... to Edgent

Hi all,

I have a basic question. My ESP32 firmware currently uses Blynk.begin(auth, ssid, pass) to connect to Wifi. If I want to change my firmware so that I can provision wifi from the Blynk 2.0 app, do I just need to
replace Blynk.begin with BlynkEdgent.begin()? Or is it more complicated than this?

Thanks so much.

Just go through the edgent example provided in the examples folder.

It is not as easy as you think. It has lots to header files that needs to be there for that functionality to work.

It’s much more complicated.
Start with the Edgent example for your board type and add-in your custom code to the .ino file (leave the .h fines untouched, apart from maybe Settings.h).

Pete.

1 Like

Ok. Understood. Btw, I’m using PlatformIO under Visual Studio Code for development. Any tips on using Edgent in this environment? Thanks.

I’m afraid I’m an Arduino IDE guy.

Pete.

1 Like

Im using Platform IO too.
Its seem that Platform cant automatically find the header files for edgent. Do i have to manually add them from the example? How come arduino ide can find this headers files on auto? Doesl blynk librari for platform.io needs update?

So main.cp is a no longer for adding custom code? Functions for updating virtual pins are still the same?

I don’t understand the question.

When you install the Blynk library via the Arduino IDE the actual installed files look like this in file explorer…

The Edgent_ESP32.ino file is the .ino file that I referred to in the text you quoted. It’s name will obviously change when you save it, but I’ll refer to it as Edgent_ESP32.ino for simplicity.
If you want to add virtual pin handlers, timers, code to read sensors etc etc then it should be added into this .ino file, not into the .h files.

You MAY need to edit the Settings.h file if the board definitions in the Edgent_ESP32.ino file and the corresponding #if defined definitions in Settings.h don’t work as you want for the hardware you’re using.
If you need more info on this then read this post…

When you open this Edgent_ESP32.ino file in the Arduino IDE the corresponding .h files are also loaded, and appear as tabs across the top of the screen, like this…

I think that in PlatformIO these should appear on the left hand side of the screen as part of your project.
If PlatformIO isn’t loading these .h files then I guess it’s a question for the PlatformIO forums.

Pete.

Before edgent update, for platform.io i could edit the main.cpp file to handle all funtionality. Maybe its different on Arduino. I will add all files manually for now because it seems blynk library on platform.io might not contain the new files.

Thank you

These files aren’t part of the library, they are part of the sketch.
The pre-Edgent examples were simply one .ino file, as are the non-Edgent examples for Blynk IoT, but edgent has a lot of complex functionality built-in to the sketch, which is why it’s split across multiple files.

Is there a reason why you’re using Edgent? What pieces if Edgent functionality are you looking for?

Pete.

2 Likes

Hello Pete,
I might need OTA firmware updates and provisioning in order to send the device to customer and have it work without me pre-configuring the wifi. The function to modify firmware remotely for devices spread across different cities would be a great thing to avoid traveling to customer site to adjust or calibrate.

You can do Blynk.Air OTA updates without the need to use Edgent, but if you need dynamic provisioning then you’ll need to use Edgent.

Did you figure-out how to get Edgent working in Platform IO?

Pete.

Didn’t know i could do OTA without Edgent, thank you Pete.

I’ve stopped working on the Platform IO and concentrated on a no-code web app development for a customer. Customer wants two projects: IoT and a Web App . They dont relate or communicate (for now) and it’s not decided yet if they will need a mobile app, dashboard or just telegram notifications and local LCD. The project hasn’t even started, im only running numbers and building PoC for them and as soon I have green light i will need to take a seat with them for them to clearly define an MVP.

So far, I’m contemplating blynk as end-to-end solution platform to quick start their product and shorten the development time compared to traditional software.

I will restart the platform.io testing and get back here with any news.

Regards