Blynk IoT watchdog

On my first Blynk projects, I had alot of issues with my devices freezing, so I added a watchdog to reboot if freeze.
I used if(Blynk.connected()) in the loop, since Blynk blocks if internet is down. After a time I would reset blynk/wifi if still disconnected.

I am updating to new Blynk and can’t figure out how do it.
Blynk.edgent() is running the connection similar to but also responsible for connection itself from what I understand.

Also Blynk.connected() always responds 0 even if there is a n active connection.

So, what I want is to be able to either feed the watchdog while Blynk.edgent is blocking, or somehow prevent Blynk.edgent from running if not connected, meanwhile reconnect.

Using ESP32. I do not want to use external watchdog as I already have the PCB’s.

This topic has been discussed several times on this forum.
Search for :
Reconnection routine

Why will find what you need.

Do you need to use the Edgent functionality?
If not then you’d be better using your original sketch and adding-in the firmware configuration code from the Blynk IoT Device Info screen at the top of your sketch and re-compiling using the latest Blynk C++ library.

If you want to use Edgent then you need to study all of the Edgent files (tabs) to fully understand how it works.


Well, I suppose I don’t “need to”, but I like to be prepared for the wifi provisioning when adding new devices. I also like OTA.

Thanks, but I have not found any about Blynk.edgent

Found the problem.

I was not aware that already has a timer function.
I was using BlynkTimer timer and in my loop and had timers hooked up to it.
This timer will never run when BlynkEdgent is blocking.
In BlynkEdgent.h I could see there is a timer already, called edgentTimer.
So I am using edgentTimer.setInterval(1000L, timer1sec); instead of timer.setInterval(1000L, timer1sec); and timers are running with or without internet, including feeding my wathchdog.

Hope this will work.