Feature Request: detection delay
Description
I would like to have the option of starting motion with a detection delay so i can leave home without getting myself detected like other kind of alarm systems have.
As there are situations where it would be nice to go from pause to start without delay and to not break existing implementations people have made outthere it should be a new point under the thread / detection menu called ex. "resume_delayed"
* reading a config option ex. "detection_delay" with value in secs or mins.
I have my doubt when it comes to the initial start
** of motion as i can think that if making a restart of motion the best would be that it happen without delay but in the case that motion is startet initial just before leaving home it would be best with the delay without first "pause" and "resume_delayed"
*.
Here a parameter -delay to motion reading the "detection_delay" value would be a solution as i cant see how motion shuld know why it's beeing (re)startet.
* There have been warned about future renaming of keywords in the config files and find it in place here to say that i find it funny that motion answer "resumed" to the "start" command. The possibility to use "start" is a result of having used the "pause" and "resume" would be a better choise to that command in that place i think.
**Sometimes it also would be usefull with the posibility to start motion with a "-paused" parameter making motion start, init threads and reading from the cams but having all threads motiondetect paused.
--
TheOtherBug - 08 Apr 2006
Follow up
I don't think motion needs that as a feature , because you can easily implement that with a bash script at least for starting motion ( just like some alarm systems do ).
A dummy example could be :
--- script start-motion.sh ----
#!/bin/bash
sleep $1
./motion &
-----------------------------
wait 50 seconds before start motion :
./start-motion.sh 50
Of course you can use motion pause / start sending http request to webinterface as well ( using wget or lwp-request ).
--
AngelCarpintero - 11 Apr 2006
I know it can be done that way and is close to the way i do it today but i have also realised that i could risk leaving home without knowing that something has failed and motion has failed to connect to one or more of the cameras or a thread has died just after motion start.
I resently had an episode where a short failure in the main power supply resultet in a switch running 2 cams had gone frosen and i would not have found out using this method.
Today i do it like this:
Start Motion, pause all threads, studdy the log for errors, if everything is okay i can start a script that start(resume) the threads on time.
I think that it is a slow difficult way to do it but feel i need to do it like that today as i have bad experience with something fails on the initial start of motion, not saying that it is motions fault.
Having the delay built into motion in combination with my "on_error(on_cameralost)" request i think i would have all chances to get warned if something has gone wrong without having to do anything else than start motion with a builtin delay.
--
TheOtherBug - 12 Apr 2006
With the current remote control interface it is easy to pause the motion detection as you already know.
I would make the script
- Start up Motion.
- Look at the Webcam interface that the cameras are running.
- Pause detection
- Resume detection
The webcam interface is really a great way to check that all cameras are working. You can make a webpage that shows all the cameras. With the mjprox project you can use mjgrab to grab one frame from each camera and show it in the browser.
And after having seen that all is OK you can have a link on that internal webpage which enables the detection after a certain number of seconds.
With PHP this is incredibly easy. And the
MjpegProxyGrab (nph-mjgrab) you can be sure that if you see a picture - the cameras are running. To remote control Motion from PHP you simply call one simple function
readfile
.
This little php snip will pause Motion for 1 minute and then resume detection. Make sure Apache will not timeout before.
<?
readfile('http://username:password@localhost:8080/0/detection/pause');
sleep(60);
readfile('http://username:password@localhost:8080/0/detection/start');
?>
It is so easy to implement in so many ways that I do not feel it is smart to add yet another option to Motion when it is not really needed. In fact small tricks like this is much better. You can let Motion run night and day and use a simple Web interface to start and pause the detection. And looking to check that your camera(s) are running is far faster and better than looking in log files.
You look up this webpage and see the picture(s) and click a link and leave.
Remember to password project or IP address the webpage so people from outside cannot pause your cameras.
--
KennethLavrsen - 12 Apr 2006