Feb 4 2013

Automatically arm/disarm motion/sound detection on the Foscams

I mentioned recently that I installed some new wireless cameras to “see” future water leaks earlier, especially when I’m away from home.

Those cameras offer actually quite a nice set of additional features. Two of them being: motion and sound detection. You can setup the cameras to automatically send emails (with camera snapshots attached) whenever the cameras “hear” or “see” something. That’s great, because then they can act like a security system as well.

Only problem is that you need to remember to turn on motion/sound detection when you leave the house and also remember to turn it off when you return to the house. Ok, so make it a habit to change the setup of the cameras upon departure/arrival. Here’s the next problem: it takes too long. If you logon to each individual camera and change the alarm settings, it takes entering username/password and several clicks to arm/disarm. Way too much work:


I looked at several Android Apps (tinyCam Monitor among them), but they also don’t seem to make “arm/disarm cameras” a single-click option.

I ended up reverse-engineering the Foscam camera protocol and created two simple scripts, which would automatically arm/disarm the cameras. Part 1 was done.

Next I needed a solution that would execute those scripts automatically. For that I installed the (excellent) AutomateIt app on my Samsung Galaxy SIII. AutomateIt allows you to have your device automatically execute certain actions when a specific event is detected. Most often this is used to lower the volume when earplugs are connected, switch off the ringer during the night, etc.

However it also has a “proximity” event. This event is fired when you get close to a location or leave an area. I defined my home as the proximity location, created one action that is executed when I leave my home and another one that is executed when I get close to my home:



Now all I have to remember is to bring my mobile phone whenever I leave the house. And that’s something my 45+ y/o brain can handle.

10 Responses to “Automatically arm/disarm motion/sound detection on the Foscams”

  • Serhii Laskavyi Says:

    P.S. I wonder, what is the first icon in the left corner of the notifications area?

  • Tobias Says:

    I think the first icon indicated that there were a number of updates to existing apps applied.

  • Kaiser Says:


    Could you let me know the name of the software that you took a screenshot of above? I’m curious about the Sound Detection Alarm software.


  • Tobias Says:

    This is a screenshot of the web interface of the Foscam IP camera. The motion/sound detection is built into the device.

  • Mason Says:

    Could you post the home-arm and home-disarm scripts? I have the same cameras and I’d love to be able to use them…

  • tobias Says:

    The arm script is here: http://pastebin.com/L9Q7wXis and the disarm script here: http://pastebin.com/eQH8R7aF – I have two cameras, that’s why the arm-script lists the command twice (forgot to remove the 2nd instance). You need to replace USERNAME, PASSWORD, CAMERA.IP.ADDRESS and PORT with the values for your camera.

  • Robert Says:

    You should sell these scripts in a self-installing EXE, I would buy them without hesitation!

    How would I go about installing the scripts as is?

  • Robert Says:

    Just a follow up, I got everything working except I cannot for the life of me figure out how to make Automateit trigger the PERL scripts. Everything else seems in order.

  • Don Says:

    Thanks for the info. I tried executing the curl commands manually from a command line. I get 404 Not Found error, which is the same error I get when entering the URL through a browser. Did Foscam change their code to use something other than CGI?

  • tobias Says:

    Hi Don – I no longer have those Foscams. Sorry – can’t help here.

Leave a Reply