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

hello sir
I still having this problem, can you please tell exactly what to do

I’d suggest that you read this…

Pete.

here is what happening

Do you mean that you aren’t able to click on the link I provided, aren’t able to understand what it means, or something else?

I’d suggest that if you are still having problems after you’ve read through the topic that I linked to then you start a new topic of your own, explaining EXACTLY what you are trying to achieve, what hardware you are using, what version of Blynk you are using, what version of the Blynk Python library you have installed, what you see in your serial monitor, and any other information that might conceivably be of use when trying to assist you with your problem.

Pete.