Send Motion-user mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/motion-user
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Motion-user digest..."
Today's Topics:
1. Re: ON_MOTION_DETECTED multiple triggering (Allan Peda)
2. Re: ON_MOTION_DETECTED multiple triggering (tosiara)
----------------------------------------------------------------------
Message: 1
Date: Thu, 23 May 2019 08:33:29 -0400
From: Allan Peda <[email protected]>
To: Motion discussion list <[email protected]>
Subject: Re: [Motion-user] ON_MOTION_DETECTED multiple triggering
Message-ID:
<caepoj6ygqce1yf8hgcv7hx4s8q66dgokl0avls0pncd3h1n...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Obviously you want to fix this the root cause, but you can modify any bash
script to disallow concurrent calls using flock.
For example if you opened up two terminals and tried to run the script
below in each, the second would exit if called before the 20 second time
limit is up.
#!/bin/bash
# prevent processes from operating concurrently.
# Variable fd represents a numeric file descriptor assigned by bash
# this fails to lock if running from an NFS shared script, probably a good
thing
#
https://stackoverflow.com/questions/46137583/prevent-other-terminals-from-running-a-script-while-another-terminal-is-using-it
exec {fd}< $0
if ! flock -n $fd
then
echo "there can be only one"
exit 1
fi
echo "Long running process starts."
sleep 20
On Thu, May 23, 2019 at 7:23 AM [email protected] <
[email protected]> wrote:
> Tosiara
>
> thanks for your reply! How do you run motion with debug logging?
>
> I set event gap to 60 but it works like before :(
>
> I digged a little bit more into the problem. So, I use Motion to detect
> nobody is at home, if no movement is detected within an hour then I switch
> all the lights off. I tried to turn the light on, and the script is
> executed multiple times for approximately 10 seconds. If, however, I switch
> the light on and then off after 1 or 2 seconds, the script is executed as
> long as the light is on: when I turn it off, the script stops getting
> triggered...
>
>
>
> Il giorno gio 23 mag 2019 alle ore 14:44 tosiara <[email protected]> ha
> scritto:
>
>> And second, set event gap. This is time period when motion is treated as
>> single event. If you specify 0, pretty every changed frame will be a new
>> event and fire the script
>>
>> On Thu, May 23, 2019, 13:41 tosiara <[email protected]> wrote:
>>
>>> Run motion with debug logging and check the output why your script is
>>> executed multiple times
>>>
>>> On Thu, May 23, 2019, 09:15 [email protected] <
>>> [email protected]> wrote:
>>>
>>>> Hi everyone! I have a problem with my motion on Raspberry 2B.
>>>> I coded a shell script that sends an MQTT message as an
>>>> ON_MOTION_DETECTED triggering. My problem is that this shell script gets
>>>> executed for several seconds in a roll, and I would like just one event to
>>>> be triggered... I use this feature to switch lights off at home when nobody
>>>> moves for at least 1 hour, so I would like that event to be triggered just
>>>> once and then to stop motion detection for (let's say) 2 seconds before
>>>> detecting a new movement
>>>>
>>>> Thanks! Please find my motion.conf file here below
>>>>
>>>>
>>>> daemon on
>>>> process_id_file /var/run/motion/motion.pid
>>>> setup_mode off
>>>> logfile /tmp/motion.log
>>>> log_level 6
>>>> log_type all
>>>> videodevice /dev/video0
>>>> v4l2_palette 17
>>>> input -1
>>>> norm 0
>>>> frequency 0
>>>> rotate 270
>>>> width 240
>>>> height 320
>>>> framerate 10
>>>> minimum_frame_time 0
>>>> netcam_keepalive off
>>>> netcam_tolerant_check off
>>>> auto_brightness off
>>>> brightness 0
>>>> contrast 0
>>>> saturation 0
>>>> hue 0
>>>> roundrobin_frames 1
>>>> roundrobin_skip 1
>>>> switchfilter off
>>>> threshold 1500
>>>> threshold_tune off
>>>> noise_level 32
>>>> noise_tune on
>>>> despeckle_filter EedDl
>>>> smart_mask_speed 0
>>>> lightswitch 0
>>>> minimum_motion_frames 1
>>>> pre_capture 0
>>>> post_capture 0
>>>> event_gap 0
>>>> max_movie_time 0
>>>> emulate_motion off
>>>> output_pictures center
>>>> output_debug_pictures off
>>>> quality 75
>>>> picture_type jpeg
>>>> ffmpeg_output_movies off
>>>> ffmpeg_output_debug_movies off
>>>> ffmpeg_timelapse 0
>>>> ffmpeg_timelapse_mode daily
>>>> ffmpeg_bps 500000
>>>> ffmpeg_variable_bitrate 0
>>>> ffmpeg_video_codec mpeg4
>>>> ffmpeg_deinterlace off
>>>> sdl_threadnr 0
>>>> use_extpipe off
>>>> snapshot_interval 0
>>>> locate_motion_mode preview
>>>> locate_motion_style redbox
>>>> text_right %Y-%m-%d\n%T-%q
>>>> text_changes on
>>>> text_event %Y%m%d%H%M%S
>>>> text_double off
>>>> target_dir /var/lib/motion
>>>> snapshot_filename %v-%Y%m%d%H%M%S-snapshot
>>>> picture_filename %v-%Y%m%d%H%M%S-%q
>>>> movie_filename %v-%Y%m%d%H%M%S
>>>> timelapse_filename %Y%m%d-timelapse
>>>> ipv6_enabled off
>>>> stream_port 8081
>>>> stream_quality 50
>>>> stream_motion off
>>>> stream_maxrate 10
>>>> stream_localhost off
>>>> stream_limit 0
>>>> stream_auth_method 0
>>>> webcontrol_port 8080
>>>> webcontrol_localhost off
>>>> webcontrol_html_output on
>>>> track_type 0
>>>> track_auto off
>>>> track_iomojo_id 0
>>>> track_step_angle_x 10
>>>> track_step_angle_y 10
>>>> track_move_wait 1
>>>> track_speed 255
>>>> track_stepsize 40
>>>> quiet on
>>>> on_motion_detected /etc/motion/on_motion_detect.sh
>>>> _______________________________________________
>>>> Motion-user mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/motion-user
>>>> https://motion-project.github.io/
>>>>
>>>> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
>>>
>>> _______________________________________________
>> Motion-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/motion-user
>> https://motion-project.github.io/
>>
>> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
>
> _______________________________________________
> Motion-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/motion-user
> https://motion-project.github.io/
>
> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
Message: 2
Date: Thu, 23 May 2019 16:35:51 +0300
From: tosiara <[email protected]>
To: Motion discussion list <[email protected]>
Subject: Re: [Motion-user] ON_MOTION_DETECTED multiple triggering
Message-ID:
<cachtdwtx-odmpcmwwy36cqeycx9tnkdmejsrk3yusyspz_e...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Set event gap to 1 hour and specify your script in on event end
On Thu, May 23, 2019, 14:22 [email protected] <[email protected]>
wrote:
> Tosiara
>
> thanks for your reply! How do you run motion with debug logging?
>
> I set event gap to 60 but it works like before :(
>
> I digged a little bit more into the problem. So, I use Motion to detect
> nobody is at home, if no movement is detected within an hour then I switch
> all the lights off. I tried to turn the light on, and the script is
> executed multiple times for approximately 10 seconds. If, however, I switch
> the light on and then off after 1 or 2 seconds, the script is executed as
> long as the light is on: when I turn it off, the script stops getting
> triggered...
>
>
>
> Il giorno gio 23 mag 2019 alle ore 14:44 tosiara <[email protected]> ha
> scritto:
>
>> And second, set event gap. This is time period when motion is treated as
>> single event. If you specify 0, pretty every changed frame will be a new
>> event and fire the script
>>
>> On Thu, May 23, 2019, 13:41 tosiara <[email protected]> wrote:
>>
>>> Run motion with debug logging and check the output why your script is
>>> executed multiple times
>>>
>>> On Thu, May 23, 2019, 09:15 [email protected] <
>>> [email protected]> wrote:
>>>
>>>> Hi everyone! I have a problem with my motion on Raspberry 2B.
>>>> I coded a shell script that sends an MQTT message as an
>>>> ON_MOTION_DETECTED triggering. My problem is that this shell script gets
>>>> executed for several seconds in a roll, and I would like just one event to
>>>> be triggered... I use this feature to switch lights off at home when nobody
>>>> moves for at least 1 hour, so I would like that event to be triggered just
>>>> once and then to stop motion detection for (let's say) 2 seconds before
>>>> detecting a new movement
>>>>
>>>> Thanks! Please find my motion.conf file here below
>>>>
>>>>
>>>> daemon on
>>>> process_id_file /var/run/motion/motion.pid
>>>> setup_mode off
>>>> logfile /tmp/motion.log
>>>> log_level 6
>>>> log_type all
>>>> videodevice /dev/video0
>>>> v4l2_palette 17
>>>> input -1
>>>> norm 0
>>>> frequency 0
>>>> rotate 270
>>>> width 240
>>>> height 320
>>>> framerate 10
>>>> minimum_frame_time 0
>>>> netcam_keepalive off
>>>> netcam_tolerant_check off
>>>> auto_brightness off
>>>> brightness 0
>>>> contrast 0
>>>> saturation 0
>>>> hue 0
>>>> roundrobin_frames 1
>>>> roundrobin_skip 1
>>>> switchfilter off
>>>> threshold 1500
>>>> threshold_tune off
>>>> noise_level 32
>>>> noise_tune on
>>>> despeckle_filter EedDl
>>>> smart_mask_speed 0
>>>> lightswitch 0
>>>> minimum_motion_frames 1
>>>> pre_capture 0
>>>> post_capture 0
>>>> event_gap 0
>>>> max_movie_time 0
>>>> emulate_motion off
>>>> output_pictures center
>>>> output_debug_pictures off
>>>> quality 75
>>>> picture_type jpeg
>>>> ffmpeg_output_movies off
>>>> ffmpeg_output_debug_movies off
>>>> ffmpeg_timelapse 0
>>>> ffmpeg_timelapse_mode daily
>>>> ffmpeg_bps 500000
>>>> ffmpeg_variable_bitrate 0
>>>> ffmpeg_video_codec mpeg4
>>>> ffmpeg_deinterlace off
>>>> sdl_threadnr 0
>>>> use_extpipe off
>>>> snapshot_interval 0
>>>> locate_motion_mode preview
>>>> locate_motion_style redbox
>>>> text_right %Y-%m-%d\n%T-%q
>>>> text_changes on
>>>> text_event %Y%m%d%H%M%S
>>>> text_double off
>>>> target_dir /var/lib/motion
>>>> snapshot_filename %v-%Y%m%d%H%M%S-snapshot
>>>> picture_filename %v-%Y%m%d%H%M%S-%q
>>>> movie_filename %v-%Y%m%d%H%M%S
>>>> timelapse_filename %Y%m%d-timelapse
>>>> ipv6_enabled off
>>>> stream_port 8081
>>>> stream_quality 50
>>>> stream_motion off
>>>> stream_maxrate 10
>>>> stream_localhost off
>>>> stream_limit 0
>>>> stream_auth_method 0
>>>> webcontrol_port 8080
>>>> webcontrol_localhost off
>>>> webcontrol_html_output on
>>>> track_type 0
>>>> track_auto off
>>>> track_iomojo_id 0
>>>> track_step_angle_x 10
>>>> track_step_angle_y 10
>>>> track_move_wait 1
>>>> track_speed 255
>>>> track_stepsize 40
>>>> quiet on
>>>> on_motion_detected /etc/motion/on_motion_detect.sh
>>>> _______________________________________________
>>>> Motion-user mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/motion-user
>>>> https://motion-project.github.io/
>>>>
>>>> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
>>>
>>> _______________________________________________
>> Motion-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/motion-user
>> https://motion-project.github.io/
>>
>> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
>
> _______________________________________________
> Motion-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/motion-user
> https://motion-project.github.io/
>
> Unsubscribe: https://lists.sourceforge.net/lists/options/motion-user
-------------- next part --------------
An HTML attachment was scrubbed...
------------------------------
------------------------------
Subject: Digest Footer
_______________________________________________
Motion-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/motion-user
------------------------------
End of Motion-user Digest, Vol 155, Issue 20
********************************************