BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Raspberry Pi + blynk-python-library -> Invalid Auth Token

Hello,

As a first step in a large project, I am trying to set up a “hello world” with Blynk and a Raspberry Pi Zero W. This project will be in Python, thus I am following the instructions provided in the blynk-python-library repo.

I copied the usage example from the repo but get an invalid auth token error:

I am getting my auth token from the Blynk website under my device’s “Device Info” tab on the Blynk website.

Here’s my code. The only difference between this and the example on the repo is that I added printing the logs and obviously my auth token.


from __future__ import print_function
import BlynkLib

# Initialize Blynk
BLYNK_AUTH = "3Ngd6Tdw9djI17trS1AfVY5aXfhlBwiz"
blynk = BlynkLib.Blynk(BLYNK_AUTH, log=print)

# Register Virtual Pins
@blynk.VIRTUAL_WRITE(1)
def my_write_handler(value):
    print('Current V1 value: {}'.format(value))

@blynk.VIRTUAL_READ(2)
def my_read_handler():
    # this widget will show some time in seconds..
    blynk.virtual_write(2, int(time.time()))

while True:
    blynk.run()

A few other notes:

  • The device is connected via wi-fi
  • I believe I am using Bylnk 2.0 but am not sure how to check
  • I do not know my Blynk server or how to find out, but I am near Vancouver, Canada
  • This will eventually be connected to the Android app, but I think that’s irrelevant at this point

Thanks for any help,
Geoff

Open the blynk app and take a screenshot.

If you’re using the Blynk Python library for Blynk 2.0 I’d expect the splash screen to say “For Python 1.0.0 (Linux)” as that is the version number in the setup.py file…

version = "1.0.0", #blynk.lib.__version__

Which is used by BlynkLib.py to print the splash screen…

print("""
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \\/  '_/
 /____/_/\\_, /_//_/_/\\_\\
        /___/ for Python v""" + __version__ + " (" + sys.platform + ")\n")

Your splash screen says v0.2.0 and the GitHub instructions say…

Note: The library has been updated for Blynk 2.0.
Please remain on v0.2.0 for legacy Blynk.

Pete.

1 Like

Thanks, should have noticed this note.
Up and running now.

Geoff

1 Like