Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Prevent motion from sensing an event at boot/daemon restart #541

Closed
michaelfisher opened this issue Nov 13, 2017 · 5 comments
Closed

Comments

@michaelfisher
Copy link

It would be helpful for motion to not record immediately upon starting. Would it be possible to have motion grab a few frames for comparison before starting detection? This is assuming that the reason it records right off the bat is that the 1st image it gets is "different" from the non-image it had at start. This behavior is problematic because the on_event_start script, which contains smart home commands, gets triggered falsely anytime the machine reboots (via cronjob). I'd happily accept using the "-m" command line option if someone could please tell me how to have the daemon run with that option.

@tosiara
Copy link
Member

tosiara commented Nov 15, 2017

Usually I don't get recording immediately after start. It may happen sometimes, but I tend to blame my USB camera which may adjust exposure at runtime when device is opened. Never investigated that further
If it happens to you, try running motion in setup mode with motion video recording and you will see which area and why is triggering motion

Another suggestion that came from user mail list is start motion with disabled detection, wait few seconds and then enable detection using http api call.

@michaelfisher
Copy link
Author

I'm running motion on a RasPi, with the RasPi camera module. Using the setup mode, I notice it may be the exposure adjusting as the camera starts up. With that in mind, I'd love to use the "start motion with disabled detection" option. I've got scripts built to make the API calls to start/stop detection based on conditions I've defined. Can you explain how to start the motion daemon with detection disabled? The "-m" option only applies when starting motion from the command line. There is currently no option to disable detection on startup in the config file.

@michaelfisher
Copy link
Author

I think I have solved this issue, though I think of it as a workaround. Within /etc/init.d/motion, in the "start" section, find the "start-stop-daemon" line. Just before the semicolon, add "-- -m" (without the quotes). Anything after the "--" is passed as an argument to the command being started. This is persistent across reboots and daemon restarts. I apologize for clogging up the issues because I failed to RTFM long enough. However, I'd still like to see this added as a config file option. Thanks for all your hard work on this project!

@lavarok
Copy link

lavarok commented Nov 16, 2017

There is a delay implemented on line 1283 of motion.c. I've increased this value on my system to prevent the issue you described. I'm using 30 seconds which seems to work well for me and the wifi cams I am using.

/* 2 sec startup delay so FPS is calculated correct */
cnt->startup_frames = (cnt->conf.frame_limit * 2) + cnt->conf.pre_capture + cnt->conf.minimum_motion_frames;

@tosiara
Copy link
Member

tosiara commented Nov 21, 2017

@Mr-Dave, maybe it is worth moving this hardcoded 2 sec value into a startup param or config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants