Controlling blynk nodes from a command line

Hello.

I was wondering if it was possible to control blynk nodes through some kind of command line shenanigans by going through a web api. If not, I was wondering if there was any way to control them from a command line in linux.

Thanks.

Could you please clarify what Blynk Node is?

Right now there is no web interface available. And it’s unlikely to appear in nearest future. We are focused on mobile solutions mainly

There is a possibility to control another blynk node via Bridge widget.
I think I can craft a python script that will automate it. Will it be ok?

@magichobo15, @Bobbo_SA, @nvddussen, @Spudgunman , @BasPeter, @deejayspinz , @Nicoyeah

Here is a python script that uses Bridge feature to control another device from the command line.
https://github.com/blynkkk/blynk-library/blob/master/scripts/blynk_ctrl.py

Please try using it, and give your feedback!

1 Like

Hey, this evolved into something even more powerful!
I added support to send multiple commands sequentially, so you can even play simple animations:

Look at the LED 9 fade for example:

python blynk_ctrl.py --token=773*******b19
                     --delayAll=0.2
                     -aw 9 50 -aw 9 100 -aw 9 150 -aw 9 200 -aw 9 255
                     -aw 9 200 -aw 9 150 -aw 9 100 -aw 9 50 -aw 9 0

P.S. digital and virtual writes are also supported, naturally.

And now even easier. This is equivalent to previous command (only for aw and dw!):

python blynk_ctrl.py --token=7736215262c242c1989a1e262fbbcb19
                     --delayAll=0.5
                     -aw 9 50 100 150 200 255 200 150 100 50 0

Hello, thank you for creating this code, it will be very useful for me. I modified your script so that it would point to a local blynk server, but it won’t connect. The error from the script is “Login failed: 0,2,9”. The error from the local server logs is

22:09:19.389 ERROR - Not secure connection attempt detected. not an SSL/TLS record: 020002001e32636266373635363639. IP /192.168.1.25:37330

Do you know what may be causing this?

You should connect to port 8442.

I am using port 8442. I just tried running the python script from the same computer running the server and it worked as expected.

@vshymanskyy

When entering a command through blynk_ctrl, it takes a few seconds to authenticate but my application requires an instant response. I was thinking I could modify your blynk_ctrl so that it would authenticate as a daemon and I could somehow send commands using its socket connection for a very fast response. I’m a beginner so I’d appreciate it if you could suggest a better alternative.

Sorry, missed your message.
I think this could be hacked to work this way… But unfortunately have no time to invest in this :frowning:

Ok, despite my poor skills I’ll make an attempt. I found the following information that I plan to use as the basis of my project. Would you mind commenting on whether or not you think this is a good place to start?

1 Like

Can you elaborate on the “ar” “dr” and “vr” commands.

Each time I try and run them I get…
" blynk_ctrl.py: error: argument -dr/–digitalRead: not enough parameters"

the “dw” and “aw” commands are working as they should.

Thanks

Please take a look at some examples inside the script.

The code mentions that reads (ar, dr, and vr) are not supported yet. I think we would both love to see this addition! @vshymanskyy

Mee too, but for now it is a limitation of the server… :frowning:

Hi @vhymansky , are there any updates on how to read virtual pins from Python? Is it still a limitation on the server?

I am trying to integrate Blynk with the Indigo Home Automation platform and require both read/write capability from Python.

Does anyone know of any Blynk Python libraries that can bot read and write virtual pins?

Hi!

I’m currently working on adding such a feature, but it requires some changes on server side and re-deployment…

Stay tuned!

@skyw33 btw, did you manage to daemonize our python script?

Any update on the server side support of the read functionality?