Passing data from piston called via URL


#1

I’m not having a problem, I just need some direction. I am calling Pistons successfully from Tasker, passing args, no issues. Now I want to return data from the Piston to Tasker. Here’s the scenario:

I want to execute a Piston remotely from Tasker using HTTP GET and have the tasker %HTTPD variable filled with a string of data. The %HTTPD variable receives the result of the HTTP GET.

If I execute a Piston using the HTTP get the HTTPD variable has something like {“result”:“OK”,“timestamp”:1506396015751} stored in it.

I am not web coder, just want to understand if there is a simple way to load the data that will be returned in that HTTPD variable or do I need to use IFTTT maker for this?


#2

There has been some discussion of letting a piston expose results in an HTTP response and in an Execute Piston call but I don’t think we know yet if it’s going to be possible. With that in mind, currently a web request or IFTTT webhook will be your best bet for pushing data out of the piston.


#3

Thank you, I figured as much but wanted to be sure before I start coding.


#4

Hi there, hope it’s ok resurrecting an old thread. I’m trying to achieve something very similar - receiving values from webcore and using them in Tasker. Again, sending values from Tasker is easy.

I’m just wondering how you got on with this @wjstefanelli - did you get a solution working to your problem?

@ipaterson - you mention web requests and IFTTT webhooks as ways of getting data out of a piston - again, this is easy enough. But I’m not sure how I would then get this info into Tasker on my phone. Any ideas?

Cheers, Chris


#5

Hello Chris, yes its straightforward you just need AutoRemote plugin in Tasker. This gives you a URL for use with webhooks in WebCore and you setup a Tasker profile to respond to the web request.

You pass an argument via webhooks that’s formatted in a way that Tasker can a) respond to the call and b) parse out the values.

There’s a good amount of Tasker documentation on this: https://joaoapps.com/autoremote/what-it-is/

If you start with the above documentation you’ll find all you need… Good Luck. Happy to help if you run into a snag, etc.


#6

Hey, thanks for the reply. I’ve not checked out the Autoremote plugin yet, although i use other plugins made by the same developer and they are really good.

However, using such a plugin isn’t really what I’m looking for as what I’d like to do is to be able to create apps via the inbuilt Tasker app builder which I can then install on guest or family member’s phones when they come to visit. However in my experience if an app uses tasker plugins, the functionality of these don’t get published with the app. So my understanding is that I’d end up having to install (and configure) the plugin on each device that I wanted to use the app on.

What I was hoping I’d be able to do is perform a HTTP ‘Get’ from Tasker to webcore and then program webcore to give the data i need (e.g. the current level of a fader) as a response to that get (which tasker then stores in a variable to be used).

From what I’ve read, however, it’s not possible to program webcore to give out such responses. I guess i was hoping that someone had found a way round that limitation and/or had another way of sending data back to tasker without the need for any additional plugins installed on the phone.

Fingers crossed someone has some ideas. :slight_smile:


#7

Ah, well another likely bigger problem is each device would need its own URL and your code in Webcore would need to handle distributing results back to the correct device. Sorry my friend, you may need some other solution such as relying on trapping notifications (call the Piston, the piston does a Notify with the variables you want to trap). Ugly to be sure but I’ve found no mechanism to get data from webcore via webhooks, just send to and from.


#8

Any update on this? I was wondering if something like this existed so we could maybe come up with an interface for ActionTiles or other dashboards. Currently when I execute my piston via External URL I get this response in browser:
{"result":"OK","timestamp":1545400346722}

Would be cool if I could set some variables (these would be user selectable to allow working with any requirements that come up from external site/tasker/dashboards) in piston like :

HttpResult.title="Kevin's Location"
HttpResult.value="At Work"
HttpResult.footer="arrived at 0800"
HttpResult.imageURL="http://x.com/office.png"
HttpResult.clickURL="http://x.com"

The new External URL call http response would be:

{"result":"OK","timestamp":1545400346722,"title":"Kevin's Location","value":"At Work", "footer":"arrived at 0800","imageURL":"http://x.com/image.png","clickURL":"http://x.com"}


#9

I believe this is confirming that the piston was executed. It does not mean the piston has run top to bottom. (IE: “result:OK” happens instantly)

If you want webCORE to send data back somewhere, you can add arguments to the piston to send out once it has collected the data you need. Here is a brief example with webCORE gathering data, and sending it to my PC using arguments.

index


You can find some more examples of this by searching here.