• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

MMM-SleepWake using external motion detection source

Scheduled Pinned Locked Moved System
16 Posts 4 Posters 7.2k Views 4 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Away
    sdetweil
    last edited by yawns Jun 11, 2018, 1:19 PM Jun 10, 2018, 5:45 PM

    Description

    Enable MagicMirror sleep from external (camera) sources

    If you are running the MM on a non PI device, or want to control sleep/wake without having to wire up another device, this module will take external info and signal MM to sleep or wake up.

    I use a Webcam camera for the motion detection, driven by the github Motion project.
    That project allows for a script to be run when motion starts and ends. I provide a script that
    creates a file for both events, and the module detects those files.

    the module supports sleep and wake 3 different ways… On PI using the tvservice command, or the exec dpms command if not using HDMI, or hiding all modules if using an energystar monitor (like my tv)

    I have submitted changes to MMM-voice and HelloLucy to allow our modules to know about the others processing… so voice Go To Sleep and motion wakeup work… if using the Hide method, modules already hidden at sleep will remain hidden on wakeup.

    Download:

    [card:sdetweil/MMM-SleepWake]


    Version 1.0

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    M 1 Reply Last reply Jun 24, 2018, 12:28 AM Reply Quote 3
    • M Offline
      Mykle1 Project Sponsor Module Developer @sdetweil
      last edited by Jun 24, 2018, 12:28 AM

      @sdetweil

      Well done, sir!

      Create a working config
      How to add modules

      1 Reply Last reply Reply Quote 0
      • E Offline
        elleclouds
        last edited by Feb 24, 2019, 4:48 PM

        Can this use a Nest Smoke Detector’s motion detecting as a trigger to activate SleepWake?

        S 1 Reply Last reply Feb 24, 2019, 5:35 PM Reply Quote 0
        • S Away
          sdetweil @elleclouds
          last edited by Feb 24, 2019, 5:35 PM

          @elleclouds I do not know. Is there a nest API the reports motion?

          I have not found the same for my ecobee room sensors

          If u can find the API, just call my little shell script to report start and end of movement

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          E 1 Reply Last reply Feb 25, 2019, 3:45 PM Reply Quote 0
          • E Offline
            elleclouds @sdetweil
            last edited by elleclouds Feb 25, 2019, 6:24 PM Feb 25, 2019, 3:45 PM

            @sdetweil Can this script be used with a raspberry pi camera? I want my mirror to wake and sleep upon detection from camera. It there a step by step for a noob as myself?

            S 1 Reply Last reply Feb 26, 2019, 1:26 PM Reply Quote 0
            • S Away
              sdetweil @elleclouds
              last edited by sdetweil Feb 26, 2019, 1:27 PM Feb 26, 2019, 1:26 PM

              @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,

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • E Offline
                elleclouds
                last edited by elleclouds Mar 11, 2019, 1:45 AM Mar 11, 2019, 1:40 AM

                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.

                S 1 Reply Last reply Mar 11, 2019, 2:28 AM Reply Quote 0
                • S Away
                  sdetweil @elleclouds
                  last edited by sdetweil Mar 11, 2019, 2:35 AM Mar 11, 2019, 2:28 AM

                  @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 shows

                  odroid@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 do

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

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 1
                  • M Offline
                    mithatcak
                    last edited by Aug 19, 2019, 11:16 PM

                    this is exactly what I need. works perfect! just hiding modules and no more ugly “NO SIGNAL” message floating on my mirror. Thank you!

                    S 1 Reply Last reply Aug 20, 2019, 2:47 PM Reply Quote 0
                    • S Away
                      sdetweil @mithatcak
                      last edited by Aug 20, 2019, 2:47 PM

                      @mithatcak glad its working !.. i use it everyday on multiple mirrors…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      • First post
                        Last post
                      Enjoying MagicMirror? Please consider a donation!
                      MagicMirror created by Michael Teeuw.
                      Forum managed by Sam, technical setup by Karsten.
                      This forum is using NodeBB as its core | Contributors
                      Contact | Privacy Policy