Closed jraiwi closed 3 years ago
I have the same issue. It's because the redirect function is not yet implemented in library.
Use:
blynk = BlynkLib.Blynk(BLYNK_AUTH, server='139.59.206.133', port=80, heartbeat=30, log=print )
instead of
blynk = BlynkLib.Blynk(BLYNK_AUTH)
EDIT
I implemented the redirect. Replace the Blynklib.py with my file. You can just place it in the same folder as your python file. Or you could import my commit. This fixes the error.
https://github.com/Lennyz1988/blynk-library-python/blob/patch-1/BlynkLib.py
My pull request #46
This will be fixed with the next update
I get the error Unexpected command: 41 every time I run the below python script ... Can anyone help?
import BlynkLib import network import machine
WIFI_SSID = 'HamzaJraiwi' WIFI_PASS = 'pass'
BLYNK_AUTH = 'auth'
print("Connecting to WiFi...") wifi = network.WLAN(network.STA_IF) wifi.active(True) wifi.connect(WIFI_SSID, WIFI_PASS) while not wifi.isconnected(): pass
print('IP:', wifi.ifconfig()[0])
print("Connecting to Blynk...") blynk = BlynkLib.Blynk(BLYNK_AUTH)
@blynk.on("connected") def blynk_connected(ping): print('Blynk ready. Ping:', ping, 'ms')
def runLoop(): while True: blynk.run() machine.idle()
Run blynk in the main thread:
runLoop()