Read the statement by Michael Teeuw here.
MMM-SleepWake using external motion detection source
-
@elleclouds I didn’t want to learn all about cameras, or be on the hook for continuing configuration options for cameras… and I found this code that handles all that AND signals motion
https://motion-project.github.io/
on its configuration page its says
Determine the type of camera v4l2 devices which are most webcams Composite capture cards Network or IP cameras The PI camera Static movie files.
it documents using the Raspberry Pi camera
Raspberry Pi cameras can be set up two different ways. If Motion is installed by using the apt packages (e.g. apt-get install motion), then the camera must be set up using the bcm2835-v4l2 module which creates a v4l2 device for the camera. Users will need to install this module using the command sudo modprobe bcm2835-v4l2. This will set up the camera as a normal v4l2 device and it can be accessed via a standard /dev/videoX device. If Motion is built from source or installed via the deb packages on the project release page, then an additional option is to set up the camera using the mmalcam_name parameter or using the bcm2835-v4l2 module. When Motion is installed via apt, the mmalcam option is not available.
Motion project can also record images on motion, movies, etc,etc,etc,etc,
-
I am a noobie, but I feel like I followed most of the instructions I’ve found online on how to get this to work, but I’m still having some issues of actually getting the mirror to turn of or on. I keep getting the error in terminal when I run motion : vid_v4lx_start: Failed to open video device /dev/video: No such file directory.
I’d greatly appreciate a video or help with set up… A youtube video would save me time and troubleshooting something that may be simple.
-
@elleclouds ok…
the motion module needs a video device…run these two commands
sudo apt-get install v4l-utils v4l2-ctl --list-devices
find the ‘camera’ device in the list
mine showsodroid@odroid:~/MagicMirror$ v4l2-ctl --list-devices s5p-mfc-dec (platform:11000000.codec): /dev/video10 /dev/video11 s5p-jpeg encoder (platform:11f50000.jpeg): /dev/video30 /dev/video31 s5p-jpeg encoder (platform:11f60000.jpeg): /dev/video32 /dev/video33 exynos-gsc gscaler (platform:13e00000.video-scaler): /dev/video20 exynos-gsc gscaler (platform:13e10000.video-scaler): /dev/video21 UVC Camera (046d:0825) (usb-xhci-hcd.3.auto-1.2): /dev/video0
the last is the camera…
so, in the motion.conf,
set the line videodevice to the value returned for the camera, in my case /dev/video0
# Videodevice to be used for capturing (default /dev/video0) # for FreeBSD default is /dev/bktr0 videodevice /dev/video0
after changing the config file
either dops -ef | grep motion get the process id (pid) use below kill -s SIGHUP pid
mine is
odroid@odroid:~/MagicMirror$ ps -ef | grep motion root 7756 1 0 Mar08 ? 00:14:21 motion
pid = 7756
or reboot
-
this is exactly what I need. works perfect! just hiding modules and no more ugly “NO SIGNAL” message floating on my mirror. Thank you!
-
@mithatcak glad its working !.. i use it everyday on multiple mirrors…
-
@sdetweil I noticed a weird issue. sometimes after several sleep&wake cycles, when it goes to sleep only the stock currentweather and weatherforecast modules stays on. there is no error in the motion.log or MM log.
here is my config, I was using delay: 5 then switched to 0.2 so I can repeat the issue faster.
{ module: "MMM-SleepWake", config:{ delay: 0.2, // default source: "external", mode: "HIDE" } // detectionDir: folder containing externally generated file when motion starts // will be created if needed // detectionFile: filename generated for motion start. default = 'detected' },
-
@mithatcak very interesting… I use those default modules too and I have never seen that behavior.
like they didn’t handle the suspend request…i have 4 systems running this everyday for months… only see the updatenotification module output on one as it doesn’t handle hide/suspend…
i will do some additional debugging
-
@mithatcak could you try something for me
i cannot reproduce this on any of my systems…
edit the MMM-SleepWake.js file
case "SLEEP_HIDE": MM.getModules().enumerate((module) => { // if the module is already hidden if(module.hidden==true) // save it for wake up {v_self1.previously_hidden.push(module.identifier);} else // hide this module {module.hide(1000);} // < --- change this line , remove the 1000 ``` should look like this ``` case "SLEEP_HIDE": MM.getModules().enumerate((module) => { // if the module is already hidden if(module.hidden==true) // save it for wake up {v_self1.previously_hidden.push(module.identifier);} else // hide this module {module.hide();} ``` let me know
-
-
@sdetweil Good news, switching to new
weather
module fixed the issue.