[solved] Webhook into Piston without IFTTT?


#1

Hi,
I have a piston that turns the light on if Sighthound IP cam software detects a person.
Right now if Sighthound detects a human in the camera view it triggers an IFTTT event that I have hooked up to a piston.

IFTTT seems to be super laggy. sometimes takes minutes to react.

Is there a way to call a piston webhook directly without IFTTT?
Sighthound offers the following webhook trigger. Could that call a Piston directly?


#2

I am unfamiliar with Sighthound, but both possibilities come to mind:

A) If Sighthound can send commands, then you should be able to use the External URL method for nearly-instant results…

B) If Sighthound cannot send commands, (and you rely on a third party app to periodically check the status), then there will always be a delay.

(the same issue we have with weather alerts. It only reports the status when queried. Push vs Pull)


A (silly) real life example:

Which do you think would give you a quicker response?

a) Asking your partner to call you when they walk in the door
-OR-
b) Repeatedly calling your house every 10min until your partner answers

If reliable, the first method always responds much quicker, with only a single data pass at the perfect precise moment… The second method requires much more work, repetition, wasted bandwidth, and much slower responses. (potentially up to 9.9 minutes late)


In these examples: a=A, and b=B… or more specifically: Partner=Sighthound, and Use Phone=Trigger


#3

The link generated by the IFTTT trigger action in webCoRE can be used anywhere, not just in IFTTT. So, if you don’t want to use the external trigger and execute the whole piston but want a specific trigger, you can take the link that is listed here:

and put that into Sitehound. That’s my preferred method rather than have the entire piston execute.


#4

I use tasker on my android phone and when either nest or my WYZE cam’s detect a person this triggers a notification on my phone which tasker picks out and sends a http post to run a webcore piston to tell me via echo speaks that one of my camera’s saw a person. I can give you the steps to setup tasker if this is something you are interested in.


#5

To answer your question though yes you can run a piston directly

You well get that in webcore by click on the settings option in the left hand side of the main webcore screen Then click on the Intergrations button which will bring you to the screen below

581846000_Pistonexec.PNG.76d2d6ba1742b36d49d16fb5363db1cd.PNG

The https://graph-na04 and it go’s on for a while. You will need to copy that as its unique to your webcore the last part will have :pistonId: you will need to replace that with the piston id of the piston you want to run. Just click on the piston you want to execute and look at the numbers at the end of the URL in your web browser its the numbers and letters in between the : symbols replace pistonId with those numbers. Make sure to leave the : symbols in place.


#6

Hmm, cant figure how to execute piston with a webhook yet.

So I can execute a webhook with text or json. not really sure what I should pick here.

In the piston below I have tried to pass a variable from sighthound to the piston.

https://graph-na02-useast1.api.smartthings.com/api/token/3essddffe87-a161-84e3-94ff-8decb6484b64c/smartapps/installations/46562dd2-a689-4b3c-9fa4-24a0c3723d44c/execute/:b67cf9a370810:/?zone1=web153

piston has a global string variable @zone1 = 0

So if zone1 is web153 trigger should execute piston action and turn the lights on.
but its not working. any suggestions?


#7

I think you have to remove the slash before the question mark. One of my URLs ends like this:

b93e4b:?PcLocked=true


The code in the receiving piston is something like this:

pic


#8

so in order to get the variable from the URL into the Piston you use the Argument tab.
(took me a while to find that).

you append your webhook URL with ?variable=string after the double colon.
https://graph-na02-useast1.api.smartthings.com/api/token/3essddffe87-a161-84e3-94ff-8decb6484b64c/smartapps/installations/46562dd2-a689-4b3c-9fa4-24a0643723d434c/execute/:b67cf9a370810: ?zone1=web154
then create a condition using arguments and set the argument as your URL variable in the piston:


#9

For those looking for a solution for PLEX
You can strip off the jpeg using a free hookdeck.com account. No Rasberry Pi needed,
Create a generic text link using the Webcore external URL link as a destination. Then put the generated hookdeck link into Plex. Once you have that…hit Plex a time or 2 to send a request through hookdeck. Then edit the connection in hookdeck adding a " Transformation" with this code:

   addHandler('transform', (request, context) => {
  // Transform the request object then return it.
  
  myBody= request.body;
  y = myBody.lastIndexOf("\r\nContent-Disposition");
  
  if (y > 100) {
  myBody=myBody.substring(0,y);
  request.body = myBody;
  }
  return request;
  });

Now my PLAY automations in webcore work great.