vshymanskyy / blynk-library-python

Blynk library for Python. Works with Python 2, Python 3, MicroPython.
https://blynk.io/
MIT License
286 stars 98 forks source link

Does not recover after disconnect #68

Open pjlfrost opened 1 year ago

pjlfrost commented 1 year ago

I'm using a Raspberry PI with the latest Python (3.9 i believe)

It works fine most of the time but as soon as I loose internet connection (for example the breaker for my router tripped) the library does not automatically re-connect to the Blynk server. The Raspberry pi will re-connect to WiFi, and logs show my python script is still running and attempting to write to the Blynk server every 10s.

I logged "blynk.state" and it changes from 2 (CONNECTED) to 0 (DISCONNECTED), and stays at 0 until I stop and re-start the python script.

I call blynk = BlynkLib.Blynk('xxx')#insert your Auth Token here up at the top. And blynk.run() in a while loop that runs constanly. In the while loop, every 10s my script gathers data then does a blynk.virtual_write(...)