Blynk RPI 3 Model B+ connect to local server

That would be the first part of your actual python script (the client) that you need to write… :stuck_out_tongue:

Check out the example scripts in the Blynk python library

oh my god is so confusing ………… what is the default example just the button and blink the led ….

Also I have to say I am so sorry for the stupid questions I am a Arduino fanboy and I have only 1 month experience with RPI…

Welcome to the dark side of Blynk… both NodeJS and Python are a bit basic and not nearly as popular as ESP/Arduino & C++

They are Beta and Alpha levels respectively… one could say, “expert” levels… not that I am expert in either myself :wink:

No actual Blink LED example, but here are some to choose from. Located in the same github site that you might have installed the Library from…

I think I found how you will understand what i am trying to find.
in Arduino there are some .ino files that are like this:

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = “YourAuthToken”;

// Your WiFi credentials.
// Set password to “” for open networks.
char ssid = “YourNetworkName”;
char pass = “YourPassword”;

void setup()
{
// Debug console
Serial.begin(9600);

Blynk.begin(auth, ssid, pass);
}

void loop()
{
Blynk.run();
}

Here if you need to connect to a local server you change the Blynk.begin section to this:

Blynk.begin(auth, ssid, pass, IPAddress(192,,,*), 8080);

and boom you have done it!

is there something similar for RPI python ? i just need to connect the pi with the local server i don’t need virtual write or anything else… the examples are to advanced for my situation

After research I found this command and tried to run it but got an error in the terminal: ./blynk command not found
is this the answer to my problems or its irrelevant if it is what do I have to install so it could run ?

This prior discussion is NOT about WiringPi (a C++ style of programming for the RPi… and one I gave up trying to use over a year ago).

I thought you said you were more comfortable with Python? I use Python 2 (IDLE) on the RPi to program Python sketches… But if you do not know how to create, edit and run Python on an RPi then you need to Google for tutorials… that level of instruction is not what this forum is about.

Or you can switch gears altogether and go the WiringPi route. It is similar C++ language but different method of editing and compiling than programming in Arduino IDE for Arduino/ESP… but I can’t help you with it.

PS, I am unsure of the disclamer…

:point_up:We don’t support BLE of Raspberry Pi 3 (yet)

As I use both Python and NodeJS on a RPi3 with Blynk… seems to work just fine.

I didn’t know that it was WiringPi im more comfortable with Python!
Ok lets just say that the sync example from the example’s folder is the right for me I have edited with the

to use it Do I just run it? (I mean run the script in terminal or smth) cause when I do I an error saying that the BlynkLib module cannot be found…

@Gunner I found the files and found a solution for my problem but I have an other one…
I try to run it and it works (!) but there is a problem I run it from this command:

python2.7 /home/pi/blynk-library-python/examples/02_virtual_read.py

but I don’t think that its the correct way because when I try to autorun it from the rc.local file I get this error:

ImportError: No module named BlynkLib

Also I get this error when I run the script like this:

sudo python2.7 /home/pi/blynk-library-python/examples/02_virtual_read.py

Is this problem irrelevant with the forum ?:roll_eyes:

Simply means the system? path doesn’t include direction to find that library. Now as far as I know (still learning linux) the install should have set the path.

But you say you did get something working… how so? What program and/or commands?

Yeap I made it all working!
I used an example from the examples folder and replaced the auth and the

blynk = BlynkLib.Blynk(BLYNK_AUTH)

with this:

blynk = BlynkLib.Blynk(BLYNK_AUTH, ‘192.xxx.x.xx’, 8080)

and with this way it connects to the local server (so it connects to itself :stuck_out_tongue_closed_eyes: )

Now if I run the command

python2.7 /home/pi/blynk-library-python/examples/02_virtual_read.py

it works correctly! without any errors…
But as far as the final ( I hope ) problem I’ve installed the library but it still returns the error…any suggestions ?

So that command works in a CLI, but not in rc.local

Doesn’t make sense to me, at least not with the error you are getting… which implies that the rc.local command IS actually working, but the library path is invalid when the script is ran that way.

Linux gives me headaches :stuck_out_tongue:

oh that’s SOOOOOO TRUE (im from Greece and now in Greece its 3:13 AM im trying to find a solution for at least 6 hours…)

After searching I found this:

and then you wrote import BlynkLib in the promt… so I checked if it works and it does…
so python 2.7 promt accepts to import the library but python 2.7 doesn’t accept it. I don’t know what to do anymore… should I ask in a RPI forum ? is this irrelevant to the Blynk forum?

Mastering (OK, even trying to guess) how python paths work was a challenge… not sure if I somehow fixed something or not by completely removing all traces of the Blynk library and reinstalling… but I just started opening, editing and running my python scripts with IDLE (for Python 2) and it just works… I haven’t bothered running any of them at boot yet as they are just experiments right now.

Shouldn’t hurt… as I am probably one of the rare members here that even use Blynk Python, And seemingly the only one who answers Python or NodeJS related questions :stuck_out_tongue_winking_eye:

Well all the tests that I’ve done are with python 2 and not python 3 so I don’t think that this is the problem…

I have never tried Python 3 myself… but I understand it is mainly different syntax that would cause issues… nothing like what you are running into… that seems mostly path related.

Perhaps add in the actual path to the import BlynkLib in your script?

Some light reading :stuck_out_tongue:

https://leemendelowitz.github.io/blog/how-does-python-find-packages.html

On my system, opening up IDLE and checking the Path Browser, I can see the correct path for my BlynkLib.py file

Compare with yours.

Then the question is, will running Python from CLI vs. rc.local use a different path 'guide"??

Well the time is 4:19 Am and i think I found the solution!! What I needed to do is to put the example script in the same folder with the BlynkLib… (That’s the moment when the solution is under your nose) now it works correctly no errors and it runs automatically on reboot… I have to say a big thank you Gunner for the help!
Also RPI is good but not good enough for the headaches that it gave to me…

Also no they use the same path guide,
In terminal if you put sudo they use the same path with the rc.local
And if you don’t the command runs like it is in the IDLE