Closed iceboatLen closed 2 years ago
@vinceemail That requires changes in the motion software. I agree that it would be nice to have an independent "forced recording" mode, rather than depend on "emulate_motion". Can you please create a new feature request in motion project?
have you @vinceemail @jasaw tried? using: http://192.168.1.14:7999/1/detection/start http://192.168.1.14:7999/1/detection/pause
where 192.168.1.14:7999 is the ip:port of your rpi
I saw that while http://192.168.1.14:7999/1/detection/status is "pause" the
http://192.168.1.14:7999/1/config/set?emulate_motion=1 http://192.168.1.14:7999/1/config/set?emulate_motion=0
where able to execute correctly saving pictures, movies, sending emails etc
saving pictures only when emulate_motion is set to 1 and not when the the Pi is actively processing the video stream, and detecting motion in the image
another possibility could be that the PIR set the camera to active processing the video stream (http://192.168.1.14:7999/1/detection/start) and then back to "pause" (http://192.168.1.14:7999/1/detection/pause)
reducing the false positives and the heating of the PI due to the active processing of videos all the time
@jasaw @ccrisan Hi I wonder if you could possibly help me. I currently have 3 raspberry pi zero with the motioneyeos installed and all 3 configured as fast network camera, I then have a raspberry pi 3b+ with motioneye installed alongside the raspberian buster. I have put the above code for external trigger on the pi 3b+ and works with no issues. What i would like to know is there a way that i could get the external trigger and the working schedule to work together.
The problem i am facing is that when i set the schedule to not trigger at certain times and i send a external trigger the motioneye still records weather or not i have set the working schedule.
any and all help would be much appreciated.
Can someone point me to where the schedule part of the code is. I think I might need to somehow add a bit of extra code there to pause or stop any readings coming in from the GPIO pins?
Hi
Can anyone please help with the above I would really really appreciate all the help or direction I can get please.
@vpmotion Look here for working schedule function: https://github.com/ccrisan/motioneye/blob/78a89fbc2e2d2c284408f8eb1037c8598b4e715a/motioneye/wsswitch.py#L34
@Jasaw
Thanks for that. Would there be a way to get the wsswitch to run a script instead of triggering the motion detection on and off?
have you @vinceemail @jasaw tried? using: http://192.168.1.14:7999/1/detection/start http://192.168.1.14:7999/1/detection/pause
where 192.168.1.14:7999 is the ip:port of your rpi
I saw that while http://192.168.1.14:7999/1/detection/status is "pause" the
http://192.168.1.14:7999/1/config/set?emulate_motion=1 http://192.168.1.14:7999/1/config/set?emulate_motion=0
where able to execute correctly saving pictures, movies, sending emails etc
saving pictures only when emulate_motion is set to 1 and not when the the Pi is actively processing the video stream, and detecting motion in the image
What a great idea!! I'll give it a shot! Thank you! :)
Right now, I am actually using a really simple hand written script, which just records and uploads a video to google drive while PIR motion is detected. It's working really well, with flawless framerates, even on a PiZero (that always seemed to be an issue for me on MotionEyeOS).
But, I'll give this a shot!
Thanks again!
@vinceemail Thank you for sharing. That is an easier way of doing it.
@vinceemail I have tried the using the above and seem to get correct responses eg emulate_motion = 1 Done but i do not see any files created, any ideas please?
have you @vinceemail @jasaw tried? using: http://192.168.1.14:7999/1/detection/start http://192.168.1.14:7999/1/detection/pause
where 192.168.1.14:7999 is the ip:port of your rpi
I saw that while http://192.168.1.14:7999/1/detection/status is "pause" the
http://192.168.1.14:7999/1/config/set?emulate_motion=1 http://192.168.1.14:7999/1/config/set?emulate_motion=0
where able to execute correctly saving pictures, movies, sending emails etc
saving pictures only when emulate_motion is set to 1 and not when the the Pi is actively processing the video stream, and detecting motion in the image
What I would like to do is constantly stream using MotionEye whilst using a PIR sensor connected to the GPIO to trigger video recording for a certain timeframe AFTER motion is detected, like how Motion does with the post_capture and post_gap settings.
Is this possible by using the above method? Or another suggested by @jasaw ?
Thanks! I'd really appreciate the help, I'm just learning RPi and just have the last piece of the puzzle to make my Bird box stream work!! :)
I added @jasaw 's script with some modifications to a git repository to have all the information spread across issues (https://github.com/ccrisan/motioneye/issues/31) at a central place: https://github.com/avanc/motioneye-pir
Feedback is always welcome!
Interestingly, it also works if motion detection is deactivated within motionEye. This is in contrast to the observations at https://github.com/ccrisan/motioneyeos/issues/842#issuecomment-513788717
I added @jasaw 's script with some modifications to a git repository to have all the information spread across issues (ccrisan/motioneye#31) at a central place: https://github.com/avanc/motioneye-pir
Feedback is always welcome!
Interestingly, it also works if motion detection is deactivated within motionEye. This is in contrast to the observations at #842 (comment)
Thank you very much! I will definitely implement this when the current system is renewed!!
@stefi01 If you want your PIR sensor to trigger motion detection and start recording, do this:
- Write some python code that reads the GPIO of your PIR output.
- On PIR trigger, run
curl "http://localhost:7999/1/config/set?emulate_motion=1"
.- When PIR stops triggering, run
curl "http://localhost:7999/1/config/set?emulate_motion=0"
.
Hello, I'm trying to start a recording with: curl "http://192.168.0.10:8085/1/config/set?emulate_motion=1" where 192.168.0.10 is the ip of my raspberry running motioneye and 8085 is the port of the camera. In motioneye I configured the file storage root directory: /home/pi/mnt/video_nas/Sala and the motioneye created correctly the folder. After that I "switched on" the "movies" ; under "record mode" I selected: motion triggered
By cmd on my pc I type: curl "http://192.168.0.10:8085/1/config/set?emulate_motion=1" and I receive:
"Warning: Binary output can mess up your terminal. Use "--output -" to tell
Warning: curl to output it to your terminal anyway, or consider "--output
Warning:
And nothing happens in the folder....
The control port is 7999. The stream port is 8085. To turn on or off functions you need to use port 7999.
The control port is 7999. The stream port is 8085. To turn on or off functions you need to use port 7999.
thanks for reply, ok but how can I choose which camera start recording? if I try: curl "http://192.168.0.10:7999/1/config/set?emulate_motion=1" i receive: curl: (7) Failed to connect to 192.168.0.10 port 7999: Connection refused
https://motion-project.github.io/motion_config.html#OptDetail_Webcontrol curl http://IP:7999/camera#/command for your case (assuming camera 5): {IP}:{port}/{camid}/action/eventstart #Trigger a new event. curl "http://192.168.0.10:7999/5/eventstart" to end: curl "http://192.168.0.10:7999/5/eventend"
https://motion-project.github.io/motion_config.html#OptDetail_Webcontrol curl http://IP:7999/camera#/command for your case (assuming camera 5): {IP}:{port}/{camid}/action/eventstart #Trigger a new event. curl "http://192.168.0.10:7999/5/eventstart" to end: curl "http://192.168.0.10:7999/5/eventend"
I checked and the control port is:
# the TCP port that motion HTTP control interface listens on
motion_control_port 7999
but for example if I type: curl "http://192.168.0.10:7999/2/action/eventstart"
the reply is: curl: (7) Failed to connect to 192.168.0.10 port 7999: Connection refused
so I suppose that the command didn't been receive
Are you running motionEye or motionEyeOS?
Are you running motionEye or motionEyeOS?
motioneye
Edit /etc/motioneye/motion.conf: set webcontrol_port 7999 setup_mode off webcontrol_parms 2 webcontrol_localhost off webcontrol_interface 1 and save restart motioneye or reboot. Web interface for motion (port 7999) should now be active for computers on local network.
Edit /etc/motioneye/motion.conf: set webcontrol_port 7999 setup_mode off webcontrol_parms 2 webcontrol_localhost off webcontrol_interface 1 and save restart motioneye or reboot. Web interface for motion (port 7999) should now be active for computers on local network.
is the same... this is the file: `
With it set correctly if I open a browser and point to: http://ip_address:7999 I get: Motion 4.2.2 Running [6] Cameras 1 2 3 4 5 6
http://ip_address:7999 I also rebooted raspberry
If you didn't follow the install instructions from here: https://github.com/ccrisan/motioneye/wiki/Installation You may also need to edit /etc/motion/motion.conf
Are you running a firewall on the 192.168.0.10? What OS are you running? Maybe Arch, or Gentoo, or something really locked down?
Are you running a firewall on the 192.168.0.10? What OS are you running? Maybe Arch, or Gentoo, or something really locked down?
It is instelled on a raspberry 3b with raspbian, no firewall...
Desktop or Lite?
If you didn't follow the install instructions from here: https://github.com/ccrisan/motioneye/wiki/Installation You may also need to edit /etc/motion/motion.c
Desktop or Lite?
desktop
Open the local browser on the Pi, and check http://localhost:7999 and in terminal try running the curl commands above...
I am building a Pi3B+ right now, latest Raspbian and updates and instructions from Wiki, with the changes I listed above.
Open the local browser on the Pi, and check http://localhost:7999 and in terminal try running the curl commands above...
On the raspberry localhost:7999 works! but not 192.168.0.10:7999.....
What does command ip a show in terminal on the Pi?
pi@raspberrypi:~ $ ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether b8:27:eb:ff:88:8b brd ff:ff:ff:ff:ff:ff inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::63aa:eb2e:6730:c243/64 scope link valid_lft forever preferred_lft forever 3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether b8:27:eb:aa:dd:de brd ff:ff:ff:ff:ff:ff
OK, interesting it can't find itself via IP. Can you ping 192.168.0.10?
OK, interesting it can't find itself via IP. Can you ping 192.168.0.10?
yes I can ping from raspberry. I can ping from pc pc also...
in the same raspberry runs a local BLYNK server and I didn't have similar problems
what port(s) does BLYNK use?
honestly I don't know... If I change the webcontrol_port from 7999 to another? for example 7888?
I missed a setting: edit /etc/motioneye/motioneye.conf change # whether motion HTTP control interface listens on # localhost or on all interfaces motion_control_localhost false
# the TCP port that motion HTTP control interface listens on motion_control_port 7999
Sorry, lack of caffeine.
restart motioneye or reboot...
Built a clean new Desktop image of RaspberryPiOS (2021/05/07 start) with all patches and updates. Installed motionEye from instructions at: https://github.com/ccrisan/motioneye/wiki/Install-On-Raspbian Edited /etc/motioneye/motioneye.conf changed: motion_control_localhost true to motion_control_localhost false and restarted motioneye. Can now send curl commands from both local network PCs and desktop. If I connect from local network PCs or Pi desktop browser I get: Motion 4.3.2 Running [2] Cameras 1 2
I missed a setting: edit /etc/motioneye/motioneye.conf change
whether motion HTTP control interface listens on
localhost or on all interfaces
motion_control_localhost false
the TCP port that motion HTTP control interface listens on
motion_control_port 7999
Sorry, lack of caffeine.
I tried to change the port to 7888 also but nothing: `
conf_path /etc/motioneye
run_path /var/run
log_path /var/log
media_path /var/lib/motioneye
log_level info
listen 0.0.0.0
port 8765
motion_control_localhost false
motion_control_port 7888
motion_check_interval 10
motion_restart_on_errors false
mount_check_interval 300
cleanup_interval 43200
remote_request_timeout 10
mjpg_client_timeout 10
mjpg_client_idle_timeout 10
smb_shares false
smb_mount_root /media
enable_reboot false
smtp_timeout 60
list_media_timeout 120
list_media_timeout_email 10
zip_timeout 500
timelapse_timeout 500
add_remove_cameras true
http_basic_auth false
webcontrol_port 7888 setup_mode off webcontrol_parms 2 webcontrol_localhost off webcontrol_interface 1 `
I don't know why there is this formatting....
I don't know. Works on my Production motionEye hub, and several test machines ( motionEye on other OSs, and RaspberryPiOS on various hardware. Can you run command: netstat -apt and report the result?
If not, my suggestion would be to start clean on a different USB or SDCard (save this setup) install RPiOS, update everything, and then just install motionEye ONLY. This would eliminate the BLYNK as being interfering, then re-add BLYNK after confirming motionEye is working.
As to the freaky text formatting, MarkUp (here in Github) thinks '#' as the first character on a line designates
I don't know. Works on my Production motionEye hub, and several test machines ( motionEye on other OSs, and RaspberryPiOS on various hardware. Can you run command: netstat -apt and report the result?
If not, my suggestion would be to start clean on a different USB or SDCard (save this setup) install RPiOS, update everything, and then just install motionEye ONLY. This would eliminate the BLYNK as being interfering, then re-add BLYNK after confirming motionEye is working.
As to the freaky text formatting, MarkUp (here in Github) thinks '#' as the first character on a line designates
BOLD
here you are:
pi@raspberrypi:~ $ netstat -apt (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:netbios-ssn 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:tproxy 0.0.0.0:* LISTEN - tcp 0 0 localhost:8082 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN - tcp 0 0 localhost:5939 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:8085 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN - tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:smtp 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:8765 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:microsoft-ds 0.0.0.0:* LISTEN - tcp 0 0 localhost:7999 0.0.0.0:* LISTEN - tcp 3493 0 192.168.0.10:34750 192.168.0.19:1025 ESTABLISHED - tcp 0 0 192.168.0.10:8765 192.168.10.1:1028 ESTABLISHED - tcp 0 0 localhost:33186 localhost:8085 ESTABLISHED - tcp 0 0 192.168.0.10:58972 dr-streamer.united:http ESTABLISHED - tcp 0 0 localhost:34412 localhost:5939 ESTABLISHED 962/TeamViewer tcp 37 0 localhost:8085 localhost:33186 ESTABLISHED - tcp 0 0 192.168.0.10:34128 192.168.0.24:http ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35594 ESTABLISHED - tcp 0 0 192.168.0.10:8765 192.168.10.1:1030 ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35608 ESTABLISHED - tcp 0 0 192.168.0.10:56218 IE-DUB-ANX-R005.te:5938 ESTABLISHED - tcp 0 0 192.168.0.10:34380 192.168.0.:microsoft-ds ESTABLISHED - tcp 0 0 192.168.0.10:58420 RS-BEG-ANX-R005.te:5938 TIME_WAIT - tcp 0 0 localhost:postgresql localhost:35602 ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35586 ESTABLISHED - tcp 0 0 192.168.0.10:51430 192.168.0.19:http ESTABLISHED - tcp 0 0 192.168.0.10:47834 192.168.0.18:rtsp ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35592 ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35542 ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35588 ESTABLISHED - tcp 0 0 localhost:5939 localhost:36754 TIME_WAIT - tcp 0 0 localhost:5939 localhost:34412 ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35600 ESTABLISHED - tcp 0 0 192.168.0.10:ssh 192.168.0.100:9847 ESTABLISHED - tcp 0 0 192.168.0.10:58978 dr-streamer.united:http ESTABLISHED - tcp 0 0 192.168.0.:microsoft-ds 192.168.0.100:1037 ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35598 ESTABLISHED - tcp 0 0 localhost:postgresql localhost:35582 ESTABLISHED - tcp 0 0 192.168.0.10:8765 192.168.10.1:1029 ESTABLISHED - tcp6 0 0 [::]:9443 [::]:* LISTEN - tcp6 0 0 [::]:netbios-ssn [::]:* LISTEN - tcp6 0 0 [::]:http-alt [::]:* LISTEN - tcp6 0 0 [::]:ssh [::]:* LISTEN - tcp6 0 0 [::]:8440 [::]:* LISTEN - tcp6 0 0 localhost:postgresql [::]:* LISTEN - tcp6 0 0 [::]:smtp [::]:* LISTEN - tcp6 0 0 [::]:microsoft-ds [::]:* LISTEN - tcp6 0 0 localhost:35608 localhost:postgresql ESTABLISHED - tcp6 0 0 192.168.0.10:http-alt 192.168.10.5:1026 ESTABLISHED - tcp6 0 0 localhost:35542 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35582 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35598 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35594 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35586 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35588 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35600 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35592 localhost:postgresql ESTABLISHED - tcp6 0 0 localhost:35602 localhost:postgresql ESTABLISHED -
Something is broken. It should be listening on 0.0.0.0 (any IP address, Eth0, Wlan0, Lo) but only seems to be listening on Lo. At this point I vote for save your current setup, Install RPiOS fresh on a USB Thumb Drive, then motionEye, and see if you can get it working there.
Yours:
tcp 0 0 localhost:7999 0.0.0.0: LISTEN Mine: tcp 0 0 0.0.0.0:7999 0.0.0.0: LISTEN 2242/motion Something is broken. It should be listening on 0.0.0.0 (any IP address, Eth0, Wlan0, Lo) but only seems to be listening on Lo. At this point I vote for save your current setup, Install RPiOS fresh on a USB Thumb Drive, then motionEye, and see if you can get it working there.
I'm scared about this... If I try to remove and install again motioneye?
Don't use your current SDCard or USB stick. Use a new (different) one. Keep the current one to switch back to. Uninstalling and re-installing on the same SDCard or USB stick has a much worse chance of surviving.
Don't use your current SDCard or USB stick. Use a new (different) one. Keep the current one to switch back to. Uninstalling and re-installing on the same SDCard or USB stick has a much worse chance of surviving.
many thanks for your support and patience. I'll schedule this new installation soon...
Don't use your current SDCard or USB stick. Use a new (different) one. Keep the current one to switch back to. Uninstalling and re-installing on the same SDCard or USB stick has a much worse chance of surviving.
I checked the configuration and I missed a part.... (motion.conf). So it was only necessary:
edit /etc/motioneye/motioneye.conf and /etc/motioneye/motion.conf: In /etc/motioneye/motion.conf Change webcontrol_localhost on To webcontrol_localhost off In /etc/motioneye/motioneye.conf Change motion_control_localhost true To motion_control_localhost false
Many thanks again!
Hello, Would it be possible to add a feature where a camera will record when prompted by an external trigger on a GPIO of the Pi, such as a PIR sensor.
Thanks Ben.