IOS App / Legacy Vers. / How to sync a VPin on Python (RPI3 - Strech)

Pi3
Blynk for Pyth. Vers 0.2.0
Stretch
IOS App Blynk 2.26.8(1)

A warm hello to all of you.

Im trying to find a working method of syncing V Pins on a Python script, when the script starts… If I switch the button / slider on the app, the running script gets the value, but I need manually doing that. All solutions I found in the last days did not work.

Similar issue in a Pyth. function, I need to manipulate the Pin value with the App that it will be recognized / read.

Example for a not working solution:

blynk.VIRTUAL_SYNC(pin)
@blynk.virtual_sync(pin)
Blynk.syncAll()
blynk.syncAll()

My guess is: that it needs a sync on start up … but im not able to get it to work in that constellation.

Anykind of suggestions welcome, if there is a other idea, to get it to work… fine, let me know pls.

THX for reading
Grufti Stefan

@JStefan please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

I don’t use Python, and I don’t use the RPI as a client device.
But, I just want to check that you’re aware that Blynk legacy is retired and the cloud servers will be decommissioned at the end of the year.
If you’re planning on running a legacy local server on your Pi then you’d probably be better with a different client device - something like a NodeMCU for example.

The other option is to run Node-Red on the Pi, with the Blynk legacy plug-in, which would allow you to read-write the Pi’s digital pins from within Node-Red.

Pete.

Hey Pete,
thx for the suggestion… we are traveling the world in our truck, see picture, and so we have not all time access to www. That’s why we will stay on the BLYNK Legacy version, for our automation… there are about 150 things which are already running fine with blynk and the RPI here on board… and just a few things are a bit :frowning:
Have a great day.

(and if you have no idea… im not a shame to ask for help :slight_smile: )

Cheers Stefan - right now in Mexiko

P.S. The digital Pins are not the headache… the Virtual I am fighting right now

Have you tried this

@blynk.on("connected")
def blynk_connected():
    # You can also use blynk.sync_virtual(pin)
    # to sync a specific virtual pin
    print("Updating V1,V2,V3 values from the server...")
    blynk.sync_virtual(1,2,3)

Hey John,
thx a lot. I did not tried that, as far as I remember. I give it a try later on…
Looking forward
Stefan

[quote=“John93, post:5, topic:61742”]

@blynk.on("connected")
def blynk_connected():
    # You can also use blynk.sync_virtual(pin)
    # to sync a specific virtual pin
    print("Updating V1,V2,V3 values from the server...")
    blynk.sync_virtual(1,2,3)

returns the following:

[/quote File "/home/pi/Progs/WWBoiler_Automatic_2-1.py", line 43, in <module>
    @blynk.on("connected")
TypeError: on() missing 1 required positional argument: 'func'

and I am not experienced enough to find the solution
if I try just the

@blynk.sync_virtual(26,110,111)

I get:

@blynk.VIRTUAL_WRITE(26) 
TypeError: 'NoneType' objekt is not callable

Thats the result. Further hints / tips / ideas more than welcome…
Saludos Stefan

I also tried the whole:
https://github.com/vshymanskyy/blynk-library-python/blob/master/examples/03_sync_virtual.py

@blynk.sync_virtual(1,2,3)
Gave it another try… works…

THX John & Pete

*Could be marked as solved…pls… :slight_smile:

1 Like