Blynk, micropython - detect and handle no interent or no wifi connection

Hi. I am using Blynk on a RP2040 running micropython. I need to stick to micropython for this project. Using the Blynk library from here: https://github.com/vshymanskyy/blynk-library-python/tree/master with a small modification to be able to run with asyncio (another requirement of my project).

If wifi is available and an internet connection is available all works great. However, how do I handle:

  1. No wifi network available? I can check when the code first runs for wlan.status() != 3, and set some flag. But even flagging out all the Blynk code my application does not run (not really sure why)
  2. Wifi network is turned off after initial connection made
  3. Wifi network connects, but no internet available

I would guess these are common scenarios, but unfortunately I cant find any solution. Blynk is the ‘icing on top’ for my project - so it is important it still runs with no wifi / internet / Blynk connection available.

Thanks for any help!

Which version of the micropython library are you using? (the bundled 0.2.0 release at the link you provided does not work with Blynk IoT, you need to use the v1.0.0 files from that location, which are not bundles into a release).

I don’t think there are many micropython users on the forum, so you might have to work-out for yourself how to skip the Blynk code, but the 07_other_functions.py example shows how to detect if Blynk is connected or disconnected.

Pete.

Hi Pete. Thanks. I am using the v1.0.0 files.

I will look at the other_functions example and give it a go :slight_smile: