Close

Web Hooks - How do I configure them ?

Having trouble with Sighthound Video? Post here for help.

Moderator: Staff

no avatar
mr.Magoo
 
Posts: 15
Joined: Wed Jan 23, 2019 8:35 am

Web Hooks - How do I configure them ?

by mr.Magoo » Wed Aug 21, 2019 1:09 pm

Is there a trick to using these ?
I've set up a very basic one, initially with the tags but I skipped them to reduce complexity.
The same basic URL that works just fine in chrome/explorer does not work in SH.

Anyone had any success setting them up ? (would be nice to have a "TEST" button as well).

Webhooks are a new feature of V6 RC1

no avatar
cwizard
 
Posts: 28
Joined: Sat Dec 16, 2017 11:37 am

Re: Web Hooks - How do I configure them ?

by cwizard » Thu Aug 22, 2019 11:00 am

Yes, I have them set up. You can see evidence of this here: https://gyazo.com/3a2b8bd2e9c4aa14a3a6ac8478127221

You should join our new Sighthound Community discord, I would be able to help you pretty quickly there.

https://discord.gg/au2Z2E2

In Discord if you want to test this you can make a Discord server for your personal use, then go and configure a channel for your notifications. You go to the webhook section and it will let you set that up, and give you a URL. This is the URL you plug into Sighthound but you also have to form the JSON correctly:

In this case I am overriding the Discord username of the bot, there are several options which I will reference after this example

Code: Select all
{
    "username": "CAMERANAME",
    "content": "Activity on CAMERANAME",
    "embeds": [{
    "title": "View Online",
    "url": "https://yourIPorDOMAIN.com:8848/#/clips/CAMERANAME/RULENAME"
     }]
}


Reference:

https://discordapp.com/developers/docs/ ... es/webhook
https://birdie0.github.io/discord-webho ... mbeds.html
https://birdie0.github.io/discord-webho ... /file.html

For other services you will format them according to their instructions, this is specifically for Discord.

Also the thing can't be sent as text, send it as Application/JSON

no avatar
mr.Magoo
 
Posts: 15
Joined: Wed Jan 23, 2019 8:35 am

Re: Web Hooks - How do I configure them ?

by mr.Magoo » Thu Aug 22, 2019 12:12 pm

I appreciate the input...


I'm using Node-Red and it's HTTP inputs and I can easily trigger them through a standard browser, but I see nothing from SightHound.

Short of setting up a wireshark log I don't even know if the event is triggered (which is why it would have been nice to have a test button).

no avatar
cwizard
 
Posts: 28
Joined: Sat Dec 16, 2017 11:37 am

Re: Web Hooks - How do I configure them ?

by cwizard » Fri Aug 23, 2019 11:14 am

I have no idea how node-red works, I'll see if I can get to the point where it's giving me a webhook URL for something =D

no avatar
cwizard
 
Posts: 28
Joined: Sat Dec 16, 2017 11:37 am

Re: Web Hooks - How do I configure them ?

by cwizard » Fri Aug 23, 2019 11:17 am


no avatar
mr.Magoo
 
Posts: 15
Joined: Wed Jan 23, 2019 8:35 am

Re: Web Hooks - How do I configure them ?

by mr.Magoo » Fri Aug 23, 2019 12:35 pm

No, the built in HTTP-IN node.

Figured it out though by setting up a socket node and seeing what came in and SightHound makes a POST request, so once I set things up accordingly it works just fine.

Only nuisance is that they include the string identifiers ' ' on the camera and rule tags but not on the time-stamp (really no need for it on any of them) so parsing it required an extra step but no biggie there.

no avatar
universe
 
Posts: 9
Joined: Thu Jan 05, 2017 9:17 pm

Re: Web Hooks - How do I configure them ?

by universe » Fri Aug 23, 2019 9:39 pm

Mr Magoo could you please share your Node-Red flow?

Also, does anyone know if it is possible to send a clip or image? Would love to pass a clip when a rule is triggered via the native iOS app in Home Assistant. That's essentially what I'll try to build using Node-Red if someone else hasn't already figured it out.

Thanks y'all.

no avatar
cwizard
 
Posts: 28
Joined: Sat Dec 16, 2017 11:37 am

Re: Web Hooks - How do I configure them ?

by cwizard » Fri Aug 23, 2019 11:20 pm

Passing an image is something on their feature request list, they are keen to include this as a feature.

no avatar
mr.Magoo
 
Posts: 15
Joined: Wed Jan 23, 2019 8:35 am

Re: Web Hooks - How do I configure them ?

by mr.Magoo » Thu Sep 12, 2019 7:14 am

universe wrote:Mr Magoo could you please share your Node-Red flow?


Sorry about the delay, not checking in too often here....

Below is my flow for capturing a webhook which then broadcasts the event on MQTT and captures a snapshot (triggered on the camera directly as it's not available on SightHound)

The delay is basically a "reset" of the trigger on MQTT since I have it tied in to my home automation.

I also attached a screenshot of the webhook setup.



Code: Select all
[{"id":"ceafee56.26a5e","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"878df658.eb0908","type":"http in","z":"ceafee56.26a5e","name":"","url":"/SighthoundVideo","method":"post","upload":false,"swaggerDoc":"","x":280,"y":280,"wires":[["58ff1ca5.bc2734","e1f5dfab.da9b6"]]},{"id":"58ff1ca5.bc2734","type":"http response","z":"ceafee56.26a5e","name":"","statusCode":"200","headers":{},"x":600,"y":280,"wires":[]},{"id":"e1f5dfab.da9b6","type":"function","z":"ceafee56.26a5e","name":"Parse Message","func":"        var tokens=msg.payload\n        tokens=tokens.replace(/'/g, \"\");\n        tokens = tokens.split(\";\");\n        msg.action1 = tokens[0];\n        msg.action2 = tokens[1];\n        msg.action3 = tokens[2];\n        msg.filename = \"S:/SnapShot/\" + msg.action1.replace(/:/g, \"\") + \"-\" + msg.action2 + \".jpg\";\n        msg.topic=\"SightHound/\"+msg.action2+\"/\"+msg.action3\n        msg.payload=1\n        return msg;\n        \n        ","outputs":1,"noerr":0,"x":460,"y":360,"wires":[["1ce4dcfe.4618a3","9337185e.2a72d8","49d7dac4.53db14","f482b43e.8b5a18"]]},{"id":"192cb32.b76914d","type":"inject","z":"ceafee56.26a5e","name":"","topic":"","payload":"2019-08-22 22:52:41;'Front Door';'People outside my region in Front Door'","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":360,"wires":[["e1f5dfab.da9b6"]]},{"id":"1702b110.f9757f","type":"change","z":"ceafee56.26a5e","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"http://172.16.1.202/cgi-bin/encoder?USER=Admin&PWD=123456&SNAPSHOT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":660,"wires":[["4c109a10.8f2db4"]]},{"id":"b871756a.87e328","type":"file","z":"ceafee56.26a5e","name":"","filename":"","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":870,"y":720,"wires":[[]]},{"id":"99579c48.c4d96","type":"change","z":"ceafee56.26a5e","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"http://172.16.1.204/cgi-bin/encoder?USER=Admin&PWD=123456&SNAPSHOT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":620,"wires":[["4c109a10.8f2db4"]]},{"id":"4c109a10.8f2db4","type":"http request","z":"ceafee56.26a5e","name":"","method":"GET","ret":"bin","paytoqs":false,"url":"","tls":"","proxy":"","authType":"basic","x":730,"y":620,"wires":[["b871756a.87e328"]]},{"id":"1ce4dcfe.4618a3","type":"switch","z":"ceafee56.26a5e","name":"Which Camera ?","property":"action2","propertyType":"msg","rules":[{"t":"eq","v":"Front Door","vt":"str"},{"t":"eq","v":"Front Yard - East","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":640,"wires":[["99579c48.c4d96"],["1702b110.f9757f"]]},{"id":"49d7dac4.53db14","type":"mqtt out","z":"ceafee56.26a5e","name":"Broadcast on MQTT","topic":"","qos":"","retain":"","broker":"caca23a1.454e3","x":980,"y":420,"wires":[]},{"id":"9337185e.2a72d8","type":"debug","z":"ceafee56.26a5e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":880,"y":220,"wires":[]},{"id":"6206df02.319e8","type":"change","z":"ceafee56.26a5e","name":"Parse Payload","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":760,"y":500,"wires":[["49d7dac4.53db14"]]},{"id":"f482b43e.8b5a18","type":"delay","z":"ceafee56.26a5e","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":500,"wires":[["6206df02.319e8"]]},{"id":"caca23a1.454e3","type":"mqtt-broker","z":"","name":"@Home_mqtt","broker":"127.0.0.1","port":"1883","clientid":"SightHound","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Attachments
Capture.PNG
Capture.PNG (6.94 KiB) Viewed 120 times


Return to Technical Support