Changing filters via the command line

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
Post Reply
wicklowman
Posts: 3
Joined: Wed Apr 26, 2006 5:41 pm

Changing filters via the command line

Post by wicklowman » Mon Jan 08, 2007 12:46 pm

Hello,

I have been using Zoneminder for the past 9 months and think it is a really excellent app. I am using it for home security and I currently have 3 cameras - 1 internal and 2 external. I have setup a filter to automatically email me video clips and generate a text message for any motion that is detected by the camera inside the house during weekday working hours. This is in case my zoneminder PC get stolen.

I sometimes get home early from work or leave late and this sends me a video and text message that I don't need. In this case, I have to change the filter configuration in Zoneminder if I remember, so that the "Automatically email details of all matches:" and "Automatically execute command on all matches: " checkboxes are not selected.

I would like to be able to run a script that makes this change via the command line. Would it be possible to change the zmfilter.pl script to make updates to the filter configuration? I would like to get a remote control like an X10 key phob to arm my house i.e. run a simple script that changes my filter configuration to automatically send emails and text when I close the front door.

Also, I have also noticed that if I have any past events that are found when the filter runs and I have disabled and re-enabled the email and execute command options in the filter, I get an email and text for all the old hits on the filter. Is there any way to set the filter to only send the new hits without deleting all of the old hits before? i.e. can a flag be set in the ZM database that marks if an email or command has already been sent for an event?

One last thing, Can anybody suggest a good key phob that can be set to run simple scripts in Linux? Thanks in advance for feedback.

Matthew

User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle
Contact:

Re: Changing filters via the command line

Post by cordel » Mon Jan 08, 2007 4:31 pm

wicklowman wrote:Would it be possible to change the zmfilter.pl script to make updates to the filter configuration?
Already possible, The configuration is in the database so the mysql client can be used.
wicklowman wrote: Also, I have also noticed that if I have any past events that are found when the filter runs and I have disabled and re-enabled the email and execute command options in the filter, I get an email and text for all the old hits on the filter. Is there any way to set the filter to only send the new hits without deleting all of the old hits before? i.e. can a flag be set in the ZM database that marks if an email or command has already been sent for an event?
Actualy that flag already exisits and thats why you don't get any duplicates. You will have to make your filter a bit smarter and add a time constraint to it like; less than 5 minutes.

wicklowman
Posts: 3
Joined: Wed Apr 26, 2006 5:41 pm

Post by wicklowman » Mon Jan 08, 2007 9:42 pm

Thanks for the quick reply.

I can't believe I didn't think about limiting my auto email filter to only display results for the past 5 mins myself! I use that feature for other filters!

Any chance you could post the mysql syntax to update the database directly? I had a look at the filters database table and it's not obvious how the value is set for filters with different names. It looks like the TINYINT(3) data type is either on or off for all of the filters. Sorry, I don't know much about mysql. Thanks again.

Matthew

User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle
Contact:

Post by cordel » Tue Jan 09, 2007 4:26 am

mysql zm -u root -p
UPDATE Filters SET AutoEmail='0' WHERE Name='FilterName';
exit
Of couse you can substitute the login root with the user you configured zm to login to the database with.
Change the systax in green ( AutoEmail='0' ) for the field you want to change and the value you want assigned (In this case would be 1 for on, and 0 for off).
Change FilterName to the name you asigned the filter.

User avatar
zoneminder
Site Admin
Posts: 5220
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder » Sun Jan 14, 2007 5:23 pm

Also, since 1.22.3, there is now a 'Backgound' flag. So if all your filter does is send you an email, or you want to diable it altogether, you can just turn off the backgrounding, while leaving the rest of the filter unchanged. If you want finer control then using the AutoEmail, AutoDelete flags is the right approach though it may take a few minutes for zmfilter.pl to pick up the change.
Phil

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests