Raspberry Pi disconnecting from Blynk2

I have set up a test just to check functionality of my Raspberry Pi and Bynk 2.
I can send data to Blynk all day long, no problem.
If I try and receive data from Blynk then the Pi disconnects after 1m 54s. Always that time.

If I use a program that sends and receives data then the send is fine there is no disconnection but the receive stops working.

I have tried this on a Raspberry PI 3 and 4, both the same results and the timing is the same.
Pi Details
NAME=“Raspbian GNU/Linux”
VERSION=“10 (buster)”

I am using Blynk library 2 as supplied by vshymanskyy
pip3 install https://github.com/vshymanskyy/blynk-library-python/archive/master.tar.gz

Python 3.9.6

This program exhibits the problem, disconnects after 1m 54s. I am using it to read 2 sliders which initially works fine.

import BlynkLib
import datetime

BLYNK_AUTH = 'tF4p1hmxxxxxxx_iBctFm4uxxxxxxx'

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

# Register virtual pin handler
@blynk.on("V*")
def blynk_handle_vpins(pin, value):
    print("V{} value: {}".format(pin, value))
   
@blynk.on("disconnected")
def blynk_disconnected():
    print('Blynk disconnected')
    print(str(datetime.datetime.now()))

print(str(datetime.datetime.now()))

while True:
    blynk.run()
    ```
This is the result printed from the program. Notice the timing always 1m 54s
   
Connecting to blynk.cloud:443...
2021-08-08 20:21:31.059358
Blynk disconnected
2021-08-08 20:23:25.113415

Connecting to blynk.cloud:443...
2021-08-08 20:23:50.385857
Blynk disconnected
2021-08-08 20:25:44.448302

Connecting to blynk.cloud:443...
2021-08-08 20:26:05.694856
Blynk disconnected
2021-08-08 20:27:59.745057

Connecting to blynk.cloud:443...
2021-08-09 12:22:11.163398
V21 value: ['23.61']
V20 value: ['25.01']
V21 value: ['24.28']
V20 value: ['26.68']
Blynk disconnected
2021-08-09 12:24:05.356756

I would be grateful for any help
John

Following on from my first post I have installed the program on an ESP32 using micro python and all works well, no disconnections.

Anybody at Blynk have any suggestions about this problem

Have you resolved this issue? FYI, the link you posted installs an old version of the lib.

Emilio

No I haven’t resolved this issue and in the absence of any help from Blynk I moved from a Pi Zero project to ESP32 running uPython, not what I want, but it works absolutely faultlessly. At the time of posting the ink to the lib it was the latest as supplied by vshymanskyy. Can you point me at the latest issue of the library, and I will give it another go.
Meanwhile I would appreciate it if anybody at Blynk could offer help.

@JohnG The Python lib for Blynk2.0 can be found here, it was updated 2 months ago.
Here I exposed a test code. However, the new lib is not stable as it causes disconnections.

Emilio
You have me confused. I have checked the version I am running against the version you linked to in your post and they both seem the same version = “1.0.0”

@JohnG If you are using esp32 then I recommend you to use the c++ library instead of the python library.

@John93 As already stated the ESP32 works faultlessly using upython, so no need for c++. The issue is getting reliable operation on Raspberry Pi.

I don’t think the raspberry pi supports blynk edgent and OTA etc… So I recommend you to use esp32 or nodemcu instead especially if you are going to use blynk commercially.

Greetings.

@John93 Your right but I am not using blynk edgent or interested in OTA. To get over the problem at the moment I am using MQTT to connect the raspi pi to the ESP32 to provide connectivity. It works fine but an unnecessary complication

Alright buddy, I wish you good luck.

Greetings.

  1. Device Online/Offline Status - Blynk Documentation

  2. https://github.com/vshymanskyy/blynk-library-python/blob/master/examples/03_sync_virtual.py

use method in while loop → blynk.sync_virtual(pin)