vshymanskyy / blynk-library-python

Blynk library for Python. Works with Python 2, Python 3, MicroPython.

Home Page:https://blynk.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not recover after disconnect

pjlfrost opened this issue · comments

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(...)