Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2PI

General Discussion

Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2PI

Postby wilsonb » Mon Jul 27, 2015 2:11 pm

Heya,

I know I can't be the only one out there wanting to do this... so I'll give it a post..

I have a few Foscam IP Cameras that I want to trigger to enable/disable the "Motion Alarm" when the DSC / AD2PI is armed and disarmed.
Anyone using these IP Cameras know that it's a manual thing to enable / disable the Motion Alarm, and if always enabled, will record EVERYTHING and constantly send emails/or fill space while your at home walking around yourself in front of it.

So, would be ideal to enable when alarm is Armed automatically.

The Foscam cameras understand CGI network communication and can successfully send a CGI command in a browser to enable / disable Motion alarms on specified cameras.
http://[yourIPaddress:port]/set_alarm.cgi?motion_armed=1&user=<yourusername>&pwd=<yourpassword>
motion_armed=1 turns Motion Detection on
motion_armed=0 turns Motion Detection off

Now to have the AlarmDecoder webapp do this would be great!! ( I guess this would be a simple feature request)
This is where I need help..... ....
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby kevin » Mon Jul 27, 2015 2:21 pm

We already support IP Camera streams and are working on adding them into the Notifications

However, you could utilize the "Custom Post" notification option and POST values on alarm to where you need them to go to start your actions.

For example

Set up a Custom Post for the Armed action to post custom key and value to URL to start
Set up a Custom Post for the Disarmed action to post custom key and value to URL to stop


Please see webapp documentation here http://www.alarmdecoder.com/wiki/index. ... m_URL_POST for a list of features and guides.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby wilsonb » Mon Jul 27, 2015 8:19 pm

Thanks.. Havent quite figured out how to get this to work.

Below is an example of turning the motion alarm on the camera. (X is in place of original data for security)

http://X.X.X.X:X/cgi-bin/CGIProxy.fcgi? ... area9=1023


for Post URL = http://ip address:port

post path? = /

urlencoded, json, or xml ?

the rest in Custom Key or Custom Value?
cgi-bin/CGIProxy.fcgi?usr=XXX&pwd=XXX&cmd=setMotionDetectConfig&isEnable=1&snapInterval=2&sensitivity=1&linkage=14&triggerInterval=5&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=1023&area6=1023&area7=1023&area8=1023&area9=1023
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby kevin » Mon Jul 27, 2015 8:25 pm

wilsonb wrote:Thanks.. Havent quite figured out how to get this to work.

Below is an example of turning the motion alarm on the camera. (X is in place of original data for security)

http://X.X.X.X:X/cgi-bin/CGIProxy.fcgi? ... area9=1023


for Post URL = http://ip address:port

post path? = /

the rest in Custom Key or Custom Value?


POST URL: ipaddress:port (exclude http://, this is what the SSL checkbox is for, on for HTTPS, off for HTTP)
POST Path: /cgi-bin/CGIProxy.fcgi

custom key and custom value would be for example
key: usr value: XXX
key: pwd value: XXX

and so forth for each value in your URL. the POST Type is urlencoded.

This is in fact if your script accepts a POST, otherwise, your POST PATH will be everything past the ipaddress:port and you won't use any custom values. (/cgi-bin/CGIProxy.fcgi?usr=XXX&pwd=XXX&cmd=setMotionDetectConfig&isEnable=1&snapInterval=2&sensitivity=1&linkage=14&triggerInterval=5&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=1023&area6=1023&area7=1023&area8=1023&area9=1023) but to be honest, I think that is much too long of a string for that field in the database, so hopefully you can POST the key value pairs.

One solution would be to implement a GET custom notification, but that will take some time.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby wilsonb » Mon Jul 27, 2015 8:32 pm

Yes, the string is to long for POST Path (255 character limit)

I didn't understand this part you mentioned;

custom key and custom value would be for example
key: usr value: XXX
key: pwd value: XXX
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby kevin » Mon Jul 27, 2015 8:35 pm

wilsonb wrote:Yes, the string is to long for POST Path (255 character limit)

I didn't understand this part you mentioned;

custom key and custom value would be for example
key: usr value: XXX
key: pwd value: XXX


So you see in your URL you have these parameters:

i?usr=XXX&pwd=XXX&cmd=setMotionDetectConfig&isEnable=1&snapInterval=2&sensitivity=1&linkage=14&triggerInterval=5&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=1023&area6=1023&area7=1023&area8=1023&area9=1023

Each one separated by an "&" is a parameter, and goes "key=value" - so you can ascertain from above where it says usr=XXX you have a key of usr and a value of XXX you just add a key and value for each one of those and fill in the proper values. After usr=XXX you see &pwd=XXX, there you see your next key value is:
pwd and XXX
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby wilsonb » Mon Jul 27, 2015 8:54 pm

Here is what I tried and it doesnt enable camera (doesn't work)
Attachments
configureCGI.JPG
snap shot
configureCGI.JPG (69.95 KiB) Viewed 12850 times
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby kevin » Mon Jul 27, 2015 8:58 pm

Well apparently the URL you are POSTing to doesn't accept a POST

You can try POSTing to a local webserver that will relay the GET or you can wait until we can implement a GET Notification - or you can try pasting your /cgi-bin/CGIProxy.fcgi?usr=XXX&pwd=XXX&cmd=setMotionDetectConfig&isEnable=1&snapInterval=2&sensitivity=1&linkage=14&triggerInterval=5&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=1023&area6=1023&area7=1023&area8=1023&area9=1023 bit into the POST PATH except shorten it to only what you need.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby kevin » Mon Jul 27, 2015 9:09 pm

Actually, there are some fixes to the custom notification support in the dev branch that aren't pushed to the master branch

If you want access to the dev branch, ssh to the pi, go to /opt/alarmdecoder-webapp

Do a "git checkout dev"
then a "git pull"

and then restart gunicorn

I totally forgot these weren't pushed to master yet, but this fixes some issues with POSTing custom key value pairs.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Controlling (enable/disable) IP WEbCAMS (Foscam) w/ AD2

Postby wilsonb » Mon Jul 27, 2015 9:13 pm

It says it's already up to date?

pi@alarmdecoder /opt/alarmdecoder-webapp $ git checkout dev
Branch dev set up to track remote branch dev from origin.
Switched to a new branch 'dev'
pi@alarmdecoder /opt/alarmdecoder-webapp $ git pull
Already up-to-date.
wilsonb
Senior Nut
Senior Nut
 
Posts: 77
Joined: Sun Jul 26, 2015 4:14 pm

Next

Return to General

Who is online

Users browsing this forum: No registered users and 36 guests

cron