BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Tasker with blynk

Has someone already got Blyn to work with Tasker?
I had some ideas on how to connect both apps but none of them worked for me.

What I have tried so far:

  • Connect tasker via ssh to a raspberry pi to control the hardware simullation program
  • Use a tcp plugin to send commands to a local blynk server (couldn’t even connect to the server)
  • program a tasker plugin (totally failed :smiley: didn’t even got the example running) if someone is interested I can post some links about writing tasker plugins

Other idea that I have not tried yet:

  • sending an email or a push notification that tasker could react to. But this works only in on direction (Blynk -> Tasker) and I need to control blynk with tasker.

I want to control my soundbar via tasker, so I can turn it on, switch it to bluetooth mode, connect my phone and play music, when i arrive at home. I don’t see any chance to achieve this without tasker. Any other ideas?

It may be possible to use the ifttt maker channel integration with tasker. Can you tell me, when this will be available?

1 Like

Maybe use an infrared led and send commands that way? I’m trying to do this right now. I like to turn on my amp, tv, set right hdmi output and maybe even turn off the light or close the curtains at the flick of a button.

Seems Pavel had good success with the IR route. You can find his example and some code at the following thread;

“Blynk RF socket”

The communication between arduino and the soundbar will be via ir signals. I have done that before without blynk and already have the necessary ir codes.
Now I need a way to let tasker tell blynk that it should turn on the soundbar.

A quickfix may be to try and have Blynk/Arduino detect if your MAC-address of the phone is present. That way you can eliminate the need for Tasker.

How could I read out the Mac address in blynk. Is it at all possible to access the Mac address as there is the blynk server and my router between the arduino and my phone.

That is the question I haven’t been thinking about, because I’m running a local Blynk server (I’m not the cloudy kind of guy, haha). So that would make it easy for me because I can just get the local ARP table and fix stuff up.

Maybe it’s possible to integrate a TCP connection to your phone with your local Arduino? That way you can determine of the TCP connections succeeds and pass it along to Blynk? You have to give your phone a fixed local IP though, but that is not really an issue.

Or get a GPS module for the Arduino, but I guess that would take a lot more tinkering.

Hey, I just got it working with the Send/Expect plugin.
Made a python script to calculate the payload for the plugin.

import struct

token = "yourtoken" #Blynk-Token
pin = "1" #Number of pin
state = "1" #1 or 0
write = "vw" #either vw(virtual) or dw(digital)

hdr = struct.Struct("!BHH")

#LOGIN
bodydata = token
data = hdr.pack(02,2,len(bodydata))
data += bodydata

#BRIDGE
bodydata = "64"+"\0"+"i"+"\0"+token
data+= hdr.pack(15,3,len(bodydata))
data+= bodydata

#COMMAND
bodydata = "64"+"\0"+write+"\0"+pin+"\0"+state
data+= hdr.pack(15,4,len(bodydata))
data+= bodydata
data = data.encode("hex")
data = "\\x"+"\\x".join(data[i:i+2] for i in range(0,len(data),2))
print data
2 Likes

This works great! Thanks a lot @Smodu
I converted your python script to JavaScript to use it directly inside Tasker and created three tasks: Blynk_Connect, Blynk_VirtualWrite and Blynk_DigitalWrite.

Blynk_Connect needs the global Variable BLYNK_AUTHTOKEN and returns the code for login and bridge command.
Blynk_VirtualWrite and Blynk_DigitalWrite both gets to parameters: pin (Parameter 1) and state (Parameter 2). They return the code for a digital/virtual write command.
You can use these tasks from any task using the Perform Task action.
Download

Here is an example on how to use them:

3 Likes

wow that is amazing , now you opened all the android capabilities to work with Blynk.
Now actual automation is possible

Amazing! It would be awesome if you could write a some kind of tutorial or step-by-step guide. We would definitely share it with our Facebook and Twitter communities! + put to documentation when it’s ready.

2 Likes

@twobe
Hey tried to make a Tasker Plugin for Blynk today.

I compiled the .apk for you.
https://drive.google.com/file/d/0B1TgjClBPiA1d1A1SHJveVY3SGc/view?usp=sharing

…or you can compile it yourself.
https://drive.google.com/file/d/0B1TgjClBPiA1VW1KaHRtWVVBWFU/view?usp=sharing

P.S: I only programmed with Java a little bit in school. So please consider that when looking through the code :smiley:

P.P.S: Only VirtualWrite works

1 Like

@smodu I will look at the plug in code when I’m back home next week :wink:

@pavel I already started to write an instructable but don’t have the time to finish it this week. I will post a link to the forum when it’s ready

3 Likes

Has there been any progress on this tasker plugin?

I am currently using the tasker ssh plugin that connects to a VPS that then runs the python script to control my esp8266. It works, but it is slow and there are a lot things that can go wrong and stop if from functioning.

I tried using the send/expect plugin that @Smodu and @twobe were describing, but I could not get it to work.

Any assistance is much appreciated.

Hi, we don’t even plan to do it. The only thing is made by community. You can search the forum

@priorguy What are your settings in the Send/Expect plugin? What data do you send? Have you tried the tasks I uploaded.
I don’t have the time to work on the tasker plugin at the moment.

Hi Blynkers!
Could you please be so kind to share step by step the way to use the plugin? I’m really new with tasker but I love the idea to use it with Blynk.
Thanks is advance!!

@twobe, @Smodu …please… Do you have any update for this matter?

Regards,

Create a new Task -> Click the plus sign -> Select “Plugin” -> Select “BlynkTaskerPlugin” -> Edit Plugin data (Pen Icon in the upper right corner) -> specify server and port (only needed if you use local server) -> enter your auth token and select the virtual pin you want to use -> click the save button and you’re done

Everything else (how to use tasker) is not specific to the Blynk plugin and is explained in a lot of tutorials you can find with google :wink:

Be aware that the Plugin isn’t a tested programm and there will be probably some bugs.

Many thanks @twobe !! I can see that the Virtual Pin selected can be “true” or “false”. If I press “Test” I can read “Success” so I understand the configuration for the plugin is correct.

I’ve done two tasks, one task to set “true” a Virtual Pin 1 and other one to set “false” same pin.
I’ve added a Profile so (in theory) the Virtual Pin is set to “true” when the Profile goes in and is set to “false” when the Profile goes out.
Does it have sense for you or I’m completely wrong?

How can I manage it at Blynk side?? :confused: