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: external trigger recording #842

Closed
iceboatLen opened this issue Mar 21, 2017 · 108 comments
Closed

Request: external trigger recording #842

iceboatLen opened this issue Mar 21, 2017 · 108 comments

Comments

@iceboatLen
Copy link

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.

@m4rky-m4rk
Copy link

I like this too. When using infra red illumination for night motion detection a big problem is the insects are attracted to IR lights causing so many false alerts outdoors IR motion detection is useless. Using PIR as a second trigger eliminates false alerts from insects... But just PIR can also cause false alerts from natural movement of leaves, wind etc. Combining both.... PIR + Motion = Recording with no false alerts :-)

@hinkma
Copy link

hinkma commented Apr 6, 2017

+1 this. I want use Piface2 board for trigger from PIR.

@jasaw
Copy link
Collaborator

jasaw commented May 30, 2017

A quick glance at motion source code suggests that USR1 signal is supposed to trigger a movie recording, and ALRM signal supposed to record a timelapsed image. I did a quick test by send both signals to motion, but didn't seem to make any difference.
Will need time to delve into the source code to figure out why.
The function is called sig_handler, in motion.c

@ccrisan
Copy link
Collaborator

ccrisan commented May 30, 2017

I remember testing that stuff with signals and it sometimes crashed and sometimes didn't work at all. I don't recall it ever working :) Anyways this was for motion 3.x. I hoped things have changed with 4.x.

@jasaw
Copy link
Collaborator

jasaw commented Jun 1, 2017

I hacked motion and got external trigger to work. Motion has emulate_motion config flag and I'm abusing it to force a recording. When USR1 signal is received, emulate_motion flag is set to 1. When USR2 signal is received, emulate_motion is set to 0. What this allows me to do is when my PIR sensor triggers, I send USR1 to motion to start recording, otherwise I send USR2 periodically to make sure emulate_motion is not left on accidentally.

Patch file attached if anyone wants to use it, just remove the txt file extension.

motion_external_trigger_hack.patch.txt

@htrdlicn
Copy link

htrdlicn commented Jun 7, 2017

+1 on this request, I have 5 Pi Zero W with PIR's ready for testing.

@jasaw
Copy link
Collaborator

jasaw commented Jun 8, 2017

Do all PIRs output the same signal e.g. output pulse low when there is motion? The pulse duration is not the same as the detected motion duration?
Someone who has worked with various PIR sensors please advise.
Technically, it's really simple to implement once we know the PIRs behaviour.

@htrdlicn
Copy link

htrdlicn commented Jun 8, 2017

They Pulse high, The two popular and inexpensive models which I have used are linked below. I currently have the SR505's wired to GPIO15 on the Pi Zero's

The behaviour is simple enough, The output pin is pulled low when there is no motion and goes high (3.3v) when motion is detected. On the SR505's this is hard wired to ~8s although there are variants that have different but fixed times. If it continues to see motion it seems to stay high, although it may be going low momentarily and then re-triggering. The SR501 has a trim pot that allows for adjustment of the pulse duration (0.3-600s). But this model is quite big.

It seems the simplest would be to start the motion event when the pin goes high and pole it once a second after that, and continue that motion event until it's low for >1s. This would accommodate either of these PIR sensors as well as dry contacts on doors quite well.

Another use case I want to use this for is the output from a car alarm, this way installations in cars don't need to process all the motion on the street, but when the shock sensor senses something, then it can record.

HC-SR505 Mini-Body Sensor Switch
eBay Listing 262130705424

HC-SR501 Adjust IR Pyroelectric Infrared PIR Motion
eBay Listing 252153857716

@jasaw
Copy link
Collaborator

jasaw commented Jun 23, 2017

I'm not familiar with motioneye code, but after a quick glance at the code, I would do something like this:

  • Setup PIR handler, probably in server.py. Maybe start_motion() function...
import os
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
PIR_PIN = 15
GPIO.setup(PIR_PIN, GPIO.IN)

def poll_pir():
    # to be called once per second
    if not GPIO.input(PIR_PIN):
        motion_pid = motionctl._get_pid()
        if motion_pid is not None:
            os.kill(motion_pid, signal.SIGUSR2)

def pir_motion_detected(PIR_PIN):
    motion_pid = motionctl._get_pid()
    if motion_pid is not None:
        os.kill(motion_pid, signal.SIGUSR1)

GPIO.add_event_detect(PIR_PIN, GPIO.RISING, callback=pir_motion_detected)
  • Call poll_pir() once per second from a timer. Motioneye already uses IOLoop, maybe piggyback it on checker() function in start_motion()? I'm not familiar with IOLoop.
  • Call GPIO.cleanup() in the clean up section, maybe run() function in server.py.
  • Also need to install RPi.GPIO python module.
  • It would be nice be able to select the GPIO number from the web front end, so some addition to main.html and main.js.

@ccrisan can definitely tell us where's an appropriate place to add PIR handler code.

@ccrisan
Copy link
Collaborator

ccrisan commented Jun 23, 2017

This can indeed be added somewhere in motionctl.py. However the reason why no such functionality exists yet is that controlling motion detection by killing the daemon is just bad. We'd need to somehow use the exposed web "API" to control that. Then, exposing a command via meyectl would help anyone build external motion controllers by simply calling it from bash scripts or whatever.

@jasaw
Copy link
Collaborator

jasaw commented Jun 23, 2017

@ccrisan After having a greater understanding of motion software, I have to agree with you that it's better done via the HTTP API.

There are 2 scenarios an external trigger can be used.

  1. External trigger OR image-based trigger = motion detected.
  2. External trigger AND image-based trigger = motion detected.

Both scenarios can be useful as pointed out by various users here.

OR scenario can be done by hitting http://127.0.0.1:7999/%(id)s/emulate_motion/%(enabled)s where "enabled" can be a string "on" or "off".

AND scenario can be done by hitting http://127.0.0.1:7999/%(id)s/detection/%(enabled)s similar to set_motion_detection function in motionctl.py to enable/disable motion detection when an external trigger is on/off respectively. The set_motion_detection function may have to be modified a bit.

@ccrisan
Copy link
Collaborator

ccrisan commented Jun 23, 2017

Yeap, both scenarios are valid and useful, each for its own use case. The best way to go about it is to implement the HTTP requests in some functions in motionctl.py and expose them (1) via a meyectl command and (2) via web handlers to motionEye's UI. The former is probably the most useful for users that want to control motion themselves.

@jasaw
Copy link
Collaborator

jasaw commented Jun 26, 2017

@ccrisan Yes, your 2nd option would be really nice. I don't see a need for meyectl. If someone wants more complicated trigger control, they can hit motionEye's HTTP interface directly from their program.

@William1Lam
Copy link

Completely new to GIT/motioneyeos, very keen to understand the architecture and coding of the system. However, I have not even managed to locate the Python and C source code. Where to start?

@jasaw
Copy link
Collaborator

jasaw commented Jul 2, 2017

@William1Lam Front-end code is motioneye.
Motion code here.
Motioneyeos repo is the build system to compile all the required programs and libraries into disk images for various platforms. Motioneyeos repo does not contain the program source code.

@William1Lam
Copy link

William1Lam commented Jul 8, 2017 via email

@lajo-osd
Copy link

lajo-osd commented Sep 3, 2017

Hi!

Any updates on this and the web handlers?

@Protarios
Copy link

On implementing such a feature, it would be perfect, if notification (mail, etc..) can be set up for each trigger type. I want to integrate motioneyeos into a doorbell, having it save a picture on motion, but only notifying if doorbell button is pushed.

@InfectedKernel
Copy link

I'm also looking forward to have kind of feature on MotionEye OS.
it will be very great and for multiple uses!

@mixpc
Copy link

mixpc commented Dec 6, 2017

+1 and thank you for labeling it as 'feature request'. Look foward to seeing that web handler in motioneye

I am more inclined to the
External trigger OR image-based trigger = motion detected.
approach so that image-based trigger may be turned off in motioneye but that is a matter of personal preference as I think it would put less workload on the cpu.

@jorgekramer
Copy link

I would like to trigger a snapshot via http-request (and then download the still-image to display it in my Home-Automation-System (FHEM)). Is there a way to do this?

@ccrisan
Copy link
Collaborator

ccrisan commented Feb 5, 2018

@jorgekramer use the Snapshot URL (which includes the required authorization signature as well).

@jorgekramer
Copy link

Tanks, it works. Is there also a way to trigger a snapshot in motioneye (e.g. if PIR in the Home-Automation-System detects motion) - and then send this image to a ftp-server?

@stefi01
Copy link

stefi01 commented Aug 12, 2018

I have mine set to zero for motion sensitivaty and it detects everything but i want mine to be used at night only, the camera is raspberry pi noir v2 ir camera, also 36 x ir 940nm leds that all turn on, gives perfect night vision in zero light for around 30feet, detects nothing at night but sees everything, the settings are all good, need a pir motion sensor to be added but how, i see lots of interest has been shown for the past year or two but no one has added this yet, why? simple arduino/raspberry pi pir sensors are advertised everywhere and very cheap.

@jasaw
Copy link
Collaborator

jasaw commented Aug 13, 2018

@stefi01 If you want your PIR sensor to trigger motion detection and start recording, do this:

  1. Write some python code that reads the GPIO of your PIR output.
  2. On PIR trigger, run curl "http://localhost:7999/1/config/set?emulate_motion=1".
  3. When PIR stops triggering, run curl "http://localhost:7999/1/config/set?emulate_motion=0".

@stefi01
Copy link

stefi01 commented Aug 13, 2018

@jasaw ok thanks for explaining, sounds easy enougth, i use my camera for night vision to see what is roaming around, i live up in mountains in california so i never know what to expect but the camera alone does not detect at all using the ir and 36 940nm leds plus another 36 on an add on board, motion setting set to zero and 2 frames to detect so i am hoping the pir works better, if i get stuck i will ask again and show what i have done but if it works then i could post those results too as it may help others i wish i found this software sooner before i started experimenting with others that dont even come close to this awsome software :) thank you for sharring

@starbasessd
Copy link

Open the local browser on the Pi, and check http://localhost:7999 and
in terminal try running the curl commands above...

@starbasessd
Copy link

I am building a Pi3B+ right now, latest Raspbian and updates and instructions from Wiki, with the changes I listed above.

@enry86cami
Copy link

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.....

@starbasessd
Copy link

What does command
ip a
show in terminal on the Pi?

@enry86cami
Copy link

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

@starbasessd
Copy link

OK, interesting it can't find itself via IP.
Can you ping 192.168.0.10?

@enry86cami
Copy link

enry86cami commented Sep 16, 2021

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

@starbasessd
Copy link

what port(s) does BLYNK use?

@enry86cami
Copy link

enry86cami commented Sep 16, 2021

honestly I don't know... If I change the webcontrol_port from 7999 to another? for example 7888?

@starbasessd
Copy link

starbasessd commented Sep 16, 2021

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.

@starbasessd
Copy link

restart motioneye or reboot...

@starbasessd
Copy link

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

@enry86cami
Copy link

enry86cami commented Sep 16, 2021

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:
`

path to the configuration directory (must be writable by motionEye)

conf_path /etc/motioneye

path to the directory where pid files go (must be writable by motionEye)

run_path /var/run

path to the directory where log files go (must be writable by motionEye)

log_path /var/log

default output path for media files (must be writable by motionEye)

media_path /var/lib/motioneye

the log level (use quiet, error, warning, info or debug)

log_level info

the IP address to listen on

(0.0.0.0 for all interfaces, 127.0.0.1 for localhost)

listen 0.0.0.0

the TCP port to listen on

port 8765

path to the motion binary to use (automatically detected if commented)

#motion_binary /usr/bin/motion

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 7888

interval in seconds at which motionEye checks if motion is running

motion_check_interval 10

whether to restart the motion daemon when an error occurs while communicating with it

motion_restart_on_errors false

interval in seconds at which motionEye checks the SMB mounts

mount_check_interval 300

interval in seconds at which the janitor is called

to remove old pictures and movies

cleanup_interval 43200

timeout in seconds to wait for response from a remote motionEye server

remote_request_timeout 10

timeout in seconds to wait for mjpg data from the motion daemon

mjpg_client_timeout 10

timeout in seconds after which an idle mjpg client is removed

(set to 0 to disable)

mjpg_client_idle_timeout 10

enable SMB shares (requires motionEye to run as root)

smb_shares false

the directory where the SMB mount points will be created

smb_mount_root /media

path to the wpa_supplicant.conf file

(enable this to configure wifi settings from the UI)

#wpa_supplicant_conf /etc/wpa_supplicant.conf

path to the localtime file

(enable this to configure the system time zone from the UI)

#local_time_file /etc/localtime

enables shutdown and rebooting after changing system settings

(such as wifi settings or time zone)

enable_reboot false

timeout in seconds to use when talking to the SMTP server

smtp_timeout 60

timeout in seconds to wait for media files list

list_media_timeout 120

timeout in seconds to wait for media files list, when sending emails

list_media_timeout_email 10

timeout in seconds to wait for zip file creation

zip_timeout 500

timeout in seconds to wait for timelapse creation

timelapse_timeout 500

enable adding and removing cameras from UI

add_remove_cameras true

enables HTTP basic authentication scheme (in addition to, not instead of the signature mechanism)

http_basic_auth false

overrides the hostname (useful if motionEye runs behind a reverse proxy)

server_name motionEye

webcontrol_port 7888
setup_mode off
webcontrol_parms 2
webcontrol_localhost off
webcontrol_interface 1
`

I don't know why there is this formatting....

@starbasessd
Copy link

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

@enry86cami
Copy link

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 -

@starbasessd
Copy link

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.

@enry86cami
Copy link

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?

@starbasessd
Copy link

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.

@enry86cami
Copy link

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...

@enry86cami
Copy link

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!

@tonicxx
Copy link

tonicxx commented Oct 20, 2021

Hi, i try run script about motion control by PIR connected to the Raspberry Pi Zero W (the same effect on two diffrent Pi and SD Card):
https://github.com/avanc/motioneye-pir
and i have problem because my raspberry still rebooting after i add options: motion_control_port 7999 to the motioneye.conf
and i cant check if script working correctly, below is my configuration an logs, maybe someone have some idea where is the problem:

motion.conf:
webcontrol_interface 1
setup_mode off
camera camera-1.conf
webcontrol_parms 2
webcontrol_localhost off
webcontrol_port 7999

motioneye.conf:
conf_path /data/etc
run_path /tmp
log_path /var/log
media_path /data/output
motion_binary /usr/bin/motion
log_level debug
listen 0.0.0.0
port 8765
mount_check_interval 300
motion_check_interval 10
motion_restart_on_errors false
motion_control_localhost true
motion_control_port 7999
cleanup_interval 43200
remote_request_timeout 10
mjpg_client_timeout 10
mjpg_client_idle_timeout 10
smb_shares false
smb_mount_root /data/media
wpa_supplicant_conf /data/etc/wpa_supplicant.conf
local_time_file /data/etc/localtime
enable_reboot false
enable_update true
smtp_timeout 60
list_media_timeout_email 10
zip_timeout 500
timelapse_timeout 500
add_remove_cameras true
http_basic_auth false
password_hook /usr/libexec/meyepasswd

motion.log
motioneye.log
dmesg.log
messages.log
camera-1.conf.log

many thanks

@starbasessd
Copy link

In motioneye.conf:
motion_control_localhost true
needs to be set to false

@tonicxx
Copy link

tonicxx commented Oct 20, 2021

the same effect, any other idea?

@starbasessd
Copy link

@tonicxx what do you get when you run the command:
netstat -tulpn
I get for TCP:
[root@meye-4cec78b8 ~]# netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 641/python
tcp 0 0 0.0.0.0:8082 0.0.0.0:* LISTEN 657/motion
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 561/proftpd: (accep
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 546/sshd: /usr/sbin
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 582/smbd
tcp 0 0 0.0.0.0:7999 0.0.0.0:* LISTEN 657/motion
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 582/smbd

This line:
tcp 0 0 0.0.0.0:7999 0.0.0.0:* LISTEN 657/motion
indicates that motion is properly listening on port 7999 for commands.
If you use a browser, what do you see?
http://ip_address:7999
If you don't see something like:
Motion 4.3.1 Running [1] Camera
1
If not, something is corrupted, and it might be faster to save your
camera settings, and re-load the SD Card. If you use dev20201026, you can boot from
a USB stick instead of the SD Card on Pi3B+ and newer.

@tonicxx
Copy link

tonicxx commented Oct 24, 2021

i get:
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1087/smbd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1147/python
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 1168/motion
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1065/proftpd: (acce
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1049/sshd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1087/smbd
tcp 0 0 0.0.0.0:7999 0.0.0.0:* LISTEN 1168/motion

Pi Zero W restarting after i add line "motion_control_port 7999" to motioneye.conf, if i remove them Pi Zero W working correctly, i try use 4 diffrent SD card with new installation and the same effect, any idea?

@starbasessd
Copy link

What do you get if you open a browser and go to
http://ip_address:7999

@tonicxx
Copy link

tonicxx commented Oct 24, 2021

i see:
Motion 4.2.2+gitUNKNOWN Running [1] Camera 1

@starbasessd
Copy link

Motion is watching the port correctly.
Your issue lies with the python scripting, and should be addressed to the creator of the scripting add-on.

@motioneye-project motioneye-project locked and limited conversation to collaborators Oct 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests