Page 1 of 1

Activate Cameras Automatically

Posted: Mon Nov 10, 2008 6:26 pm
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!

Posted: Mon Nov 10, 2008 8:37 pm
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

Posted: Mon Nov 10, 2008 9:30 pm
by Kepesk
Oh, thanks! Why didn't I think of that? I'll give it a whirl and we'll see how it goes!

Posted: Mon Nov 10, 2008 10:01 pm
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

Posted: Wed Nov 12, 2008 10:40 pm
by zoneminder
I think a second start etc should be ignored though I can't swear by it :?

Posted: Thu Nov 13, 2008 5:45 am
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.

Posted: Thu Nov 13, 2008 4:28 pm
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.

Posted: Sat Nov 22, 2008 6:03 pm
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!

Bluetooth with mobile

Posted: Sun Nov 23, 2008 5:42 pm
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

Posted: Sun Nov 23, 2008 7:41 pm
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.

Multipul BT dongles

Posted: Sun Nov 23, 2008 9:14 pm
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.

Posted: Mon Nov 24, 2008 6:52 am
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. :)