setProperty Blynklib.py

Am I the only one that can not use the setProperty command in python?
I think that I have the latest blynk python library but I am not sure, i’d love to have a link to check it.
I did a pip install of the library, I downloaded from GitHub this library from the clone or download button
(when I use this library I cant even run the program, it says that the

BlynkLib.Blynk(Blynk_AUTH, ‘111’, 8080)

is wrong formatted,(error:)

TypeError: init() takes exactly 2 arguments (4 given)

), also I downloaded from the downloads button in the readme section of the GitHub page(this runs but it seams there isn’t a setProperty setting) but had no luck.
My code:

import BlynkLib

BLYNK_AUTH = ‘nn’

Blynk = BlynkLib.Blynk(BLYNK_AUTH, ‘111’, 8080)

@Blynk.VIRTUAL_WRITE(6)
def v6_write_handler(value):
Blynk.setProperty(V15, “color”, “#42D286”)
Blynk.run()

the V6 is a button that I press and the V15 is a button that gets its color changed.

Am I doing something wrong? Any ideas? thanks in advance!

This was already mentioned, and acknowledged by the developer, in another topic you were part of… and simply hasn’t been implemented yet… Patience.

This sounds like you are simply using the wrong format… what is the ‘111’ for?

Use just the needed arguments:

BLYNK_AUTH = 'YourAuthToken'

# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)

Update:

OK, I managed to manually install (aka copy over) the ver.0.2.0 Blynklib.py and it also gives me the same error, on a previously good script, when trying to account for my local server… which I now assume you were doing with the cryptic '111'

pi@raspberrypi3:~ $ python pytest.py

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ for Python v0.2.0

Traceback (most recent call last):
  File "pytest.py", line 6, in <module>
    blynk = BlynkLib.Blynk(BLYNK_AUTH, '10.10.3.13', 8080)
TypeError: __init__() takes exactly 2 arguments (4 given)
pi@raspberrypi3:~ $ 

My recommendations for now is to stick with the ver.0.1.3 Blynklib.py until @vshymanskyy has time to look into it.

pi@raspberrypi3:~ $ python pytest.py

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/

  Give Blynk a Github star! => https://github.com/vshymanskyy/blynk-library-python

TCP: Connecting to 10.10.3.13:8080
Blynk connection successful, authenticating...
Access granted, happy Blynking!

And to add to the fun… I did find this in the ver.0.2.0 Blynklib.py file…

image

But that file is actual dated prior to the previously referenced topic about it missing… and of course that version seems to have issues configuring with a local server… All so very confusing :confounded: I am too exhausted to look into it anymore… right now…

Hey thanks for the research, yes I know that I already asked this in an other topic but some other blynkers commented on my topic and used the setProperty command and I think that they said it worked. That’s why I wanted to create a new clean topic with all the libraries I’ve installed just to make sure that it’s not already added.
Is there a way to automatically update the library when there is an update?
Also the ‘111’ is the ip of my local server(as correctly you assumed).

Also I’m so happy that you found it on the v2.0 that means it will work soon! That’s again…!!

@Smackflad setProperty does work with Python if you have the correct library.

Syntax is:

blynk.set_property(7, "color", "#ED9D00")  # set color for text on V7 to yellow

Hey Costas glad you responded!
Well it worked with buttons does it work with the Image widget?
when I use that command:

blynk.set_property(5, “url”, 1, “http://0.0.0.0/Desktop/test3.png”)

it wont work, it returns a syntax error.

Again thanks for helping!

For more info:
it says that the set_property takes exactly 4 arguments, 1 the self and 3 that the user gives(I suppose).
for the opacity, scale and rotation it works, for the url and urls it dosent.

@Smackflad the following syntax is updating my images in Python:

blynk.set_property(5, “urls”, “http://0.0.0.0/Desktop/test3.png”)

that’s odd, I just copy pasted this command and it crashed.
Also I can see in my http server logs that there is no request
code:

import BlynkLib

BLYNK_AUTH = ‘xxx’

Blynk = BlynkLib.Blynk(BLYNK_AUTH, ‘192.168.2.12’, 8080)

@Blynk.VIRTUAL_WRITE(6)
def v6_write_handler(value):
Blynk.set_property(5, “urls”, “http://xxx:xxxx/Desktop/test3.png”)
Blynk.virtual_write(5, 1)

Blynk.run()

maybe I have something wrong with my code?

Look at my (excellent) code again!!!

I’m sorry but I miss it… whats wrong with mine?:confounded::confounded:

lowercase blynk

well I don’t think that that’s the case because I declare in the top Blynk = Blynklib.Blynk….
Also tried it like that:

import BlynkLib

BLYNK_AUTH = ‘xxx’

blynk = BlynkLib.Blynk(BLYNK_AUTH, ‘192.168.2.12’, 8080)

@blynk.VIRTUAL_WRITE(6)
def v6_write_handler(value):
blynk.set_property(5, “urls”, “http://xxx:xxx/Desktop/test3.png”)
print(“test”)
blynk.run()

and still wont work.

if I declare it like Blynk and then use blynk it will crash when I execute the script

All working fine for me but I am using external urls:

# initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH, 'someserver.com', 80)

def blynk_connected():
    # You can also use blynk.sync_virtual(pin)
    # to sync a specific virtual pin
    print("Updating V2 from the server...")
    blynk.sync_virtual(2)	# just sync V2
    blynk.set_property(3, "urls", "https://peacefairapp.com/fota/pzem/images/PubBot.png") # OK update image on V3	

2 Likes

well I don’t know how is that possible…
can you please provide me a peace of code with virtual write?
press a button on v6 and update the url on the image widget v5.
I’m really excocted with this situation… 1 or 2 months I’m trying to figure this out

changed the url and used your pub url and it still wont work…

code:

import BlynkLib

BLYNK_AUTH = ‘xxx’

blynk = BlynkLib.Blynk(BLYNK_AUTH, ‘192.168.2.12’, 8080)

@blynk.VIRTUAL_WRITE(26)
def v6_write_handler(value):
blynk.set_property(25, “urls”, “https://peacefairapp.com/fota/pzem/images/PubBot.png”)
blynk.run()