Activate Cameras Automatically

Support and queries relating to all previous versions of ZoneMinder
Locked
Kepesk
Posts: 6
Joined: Mon Nov 10, 2008 6:17 pm

Activate Cameras Automatically

Post by Kepesk »

Hello!

I was trying to figure out a simple way to deactivate cameras when I get home and activate them when I leave when I realized I carry a phone with me that connects to my wireless network whenever I am home. So I'm trying to think of ways to use that to automatically activate and deactivate the cameras.

So here's my question:

Is there any way I can have the computer detect when a certain IP address has appeared on (or disappeared from) my network and change the ZoneMinder run state appropriately?

I'm using Ubuntu 8.10 with ZoneMinder 1.23.3

Thanks!
coke
Posts: 518
Joined: Wed Jan 30, 2008 5:53 pm
Location: St. Louis, MO, USA

Post by coke »

How about adding a cron job to periodically run something like this?

Code: Select all

#!/bin/sh
if ping -qnw1 -c1 192.168.254.109 2>&1 >/dev/null
then
/usr/local/bin/zmpkg.pl start
else
/usr/local/bin/zmpkg.pl stop
fi
Kepesk
Posts: 6
Joined: Mon Nov 10, 2008 6:17 pm

Post by Kepesk »

Oh, thanks! Why didn't I think of that? I'll give it a whirl and we'll see how it goes!
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Your going to likely want to add to that. You don't want to send a start when zm is already running.

Code: Select all

#!/bin/sh
command=/usr/local/bin/zmpkg.pl

result=`$command status'
if ping -qnw1 -c1 192.168.254.109 2>&1 >/dev/null
then
    if [ "$result" = "stopped" ]; then
    $command start
    fi
else
    if [ "$result" = "running" ]; then
    $command stop
    fi
fi
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I think a second start etc should be ignored though I can't swear by it :?
Phil
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

Also see my post about using a USB thumbdrive to change the run state.

http://www.zoneminder.com/forums/viewto ... 0&start=19

(my discovery spans a few posts)

You have a phone that connects to your WLAN and stays connected? Doesn't that kill the phone's battery life? I'd worry that if the battery died or the WLAN went down (or the IP address changed) I'd start recording things going on at home, and possibly sending emails/uploading files for hours.

Then again there have been times when I've forgotten to plug the USB stick back in when I've arrived home, only to find my inbox (and FTP server) full of events showing me walking around the house. So your solution would be better, assuming you didn't leave the phone in the car.

To prevent forgetfulness and remember to disarm the system, I thought about using ubuntu's "beep" command to beep the speaker now and then when the system is armed, but the ZM box is in a cabinet inside a room and it's hard to hear the speaker, so it's not ideal.

Just some ruminations. I'm semi-obsessed with improving visualization and control and *not* requiring web access to interact with ZM on a basic operational level, so solutions like your phone/IP solution are fascinating to me.
coke
Posts: 518
Joined: Wed Jan 30, 2008 5:53 pm
Location: St. Louis, MO, USA

Post by coke »

On that note, if you happen to have a variety of the Axis models, they have outputs which can respond to remote triggers (a properly formatted wget or curl should do the job). You could set one of those up to a light(s) and turn them on/off when the system is live/not.

Depending on your texting plan and whether or not you pay for them, you could also send an email from the box to your phone as a text message telling you when it's activating/deactivating. There's some sort of SMS plugin available, but a simple email to phonenumber@txt.provider.com (variers by provider) would be easy. That may be a great way to find out if your phone's keeping a consistent wlan connection when home, if you get a barrage while you're home.
Kepesk
Posts: 6
Joined: Mon Nov 10, 2008 6:17 pm

Post by Kepesk »

Hah, that solution works perfectly! I had to tinker with it slightly to work with my environment, but there you have it!

As for battery life, my phone is usually charging when I'm at home, so it really won't make a lot of difference.

Thanks guys!
Jason_Bassett
Posts: 42
Joined: Wed Mar 05, 2008 10:33 pm
Location: Stanford-Le-Hope, Thurrock, Essex

Bluetooth with mobile

Post by Jason_Bassett »

Hello

I have a similar setup for my Asterisk server, it has a bluetooth dongle in it which detects my bluetooth phone is present and changes the dialplan to not bother forwarding calls out of the house.

Heres the guide for Asterisk, likely to be partly relevant for Zoneminder:

http://nerdvittles.com/index.php?p=78

J
Last edited by Jason_Bassett on Thu Aug 19, 2010 10:56 am, edited 1 time in total.
Corrilan IT Consultancy Ltd
http://www.corrilan.com
01375 403508
enquiries@corrilan.com
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

These are such cool ideas. I love the BT one (since the BT radios on our phones are always on), but my house is laid out "long" and BT won't stay connected from one end to the other. I could try wiring a dongle to a USB extension (15ft max) and move it toward the center of the house....then a cron job could run and check for the presence of at least one of our BT phones and change the runstate accordingly.

Lots to think about. I'm still toying with the idea of a keypad but they're not cheap.
Jason_Bassett
Posts: 42
Joined: Wed Mar 05, 2008 10:33 pm
Location: Stanford-Le-Hope, Thurrock, Essex

Multipul BT dongles

Post by Jason_Bassett »

How about multipul BT dongles to cover the premises. Either connected to same machine using long cables or even on multipul machines if you have them on in various placed.
Last edited by Jason_Bassett on Thu Aug 19, 2010 10:56 am, edited 1 time in total.
Corrilan IT Consultancy Ltd
http://www.corrilan.com
01375 403508
enquiries@corrilan.com
haus
Posts: 213
Joined: Thu Oct 11, 2007 5:10 am

Post by haus »

USB is limited to 15 feet or so, IIRC, and having multiple machines introduces too many points of failure for my taste. The simpler the setup, the better. That's not to say that a well-placed dongle 15 feet from the machine isn't workable, but it's not a sure thing until I test it. :)
Locked