• 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-PIR-Sensor tuning

Scheduled Pinned Locked Moved Troubleshooting
40 Posts 7 Posters 31.1k Views 6 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.
  • J Offline
    Jopyth Moderator @KirAsh4
    last edited by Jopyth Oct 5, 2016, 8:13 PM Oct 5, 2016, 8:12 PM

    @KirAsh4 I agree with you, but it also depends on what we are debugging. I looked at the particular way @jc21 implemented it, and it seems all the debug information are shown in the process manager logs only.

    Helpful sticky: How to troubleshoot

    1 Reply Last reply Reply Quote 0
    • K Offline
      KirAsh4 Moderator
      last edited by Oct 5, 2016, 8:13 PM

      I’m not saying it’s wrong, nor right. I just prefer to use one facility that will show everything, as opposed to one that might only show some things.

      A Life? Cool! Where can I download one of those from?

      1 Reply Last reply Reply Quote 0
      • J Offline
        jc21
        last edited by Oct 5, 2016, 10:58 PM

        I agree, a central place for logging info would be ideal but that’s just not possible with MM at this point.

        This is a bit out of scope for this topic, however unless you’re across the module system in depth you may not be aware that there are 2 separate “processes” to the MM for lack of a better word

        • The UI, electron app that uses console.log and outputs to the chrome dev console if active
        • The Server App, express & module node_helpers that uses console.log to output to stdout of the process

        With the way MM module system is implemented, using any additional NPM packages required by a module can only be done on the NodeJS App side (as far as I’m aware?), not in the UI where the browser dev console log is available.

        That said, for this module particularly, if the UI was started with the dev console option then when motion is detected or no longer detected, the Node JS App will log a USER_PRESENCE socket event where the value will either be true or false respectively. This is the case for both the original github repo and my fork. Unfortunately the dev console event system doesn’t log the value so debugging on/off values is not possible:

        calendar received a module notification: USER_PRESENCE from sender: MMM-PIR-Sensor
        

        I don’t use PM2 yet, but to start the MM with dev console on just add the dev argument:

        electron js/electron.js dev
        
        S 1 Reply Last reply Oct 6, 2016, 4:14 PM Reply Quote 0
        • S Offline
          shgmongohh @jc21
          last edited by Oct 6, 2016, 4:14 PM

          @jc21
          Sorry, I have some issues with your MMM-PIR-Sensor.
          When I install your MMM-PIR-Sensor, my MagicMirror is slower, the MMM-Scheduler doesn´t work and the MM doesn´t stop with pm2 stop mm.
          Any idea?

          1 Reply Last reply Reply Quote 0
          • J Offline
            jc21
            last edited by Oct 6, 2016, 10:32 PM

            Do you experience the same thing with paviro’s original module? https://github.com/paviro/MMM-PIR-Sensor

            S 1 Reply Last reply Oct 7, 2016, 4:42 AM Reply Quote 0
            • S Offline
              shgmongohh @jc21
              last edited by Oct 7, 2016, 4:42 AM

              @jc21
              No with the “original” PIR-Sensor I don´t have this issues. That´s why I it noticed.

              I have still the issue with the sensor, that it turns on the monitior at night, when nobody is there. I need a programm to track, how often this at night happens. If it is only one or two times at night or more often.

              Sebastian

              J 1 Reply Last reply Oct 7, 2016, 4:46 AM Reply Quote 0
              • J Offline
                jc21 @shgmongohh
                last edited by Oct 7, 2016, 4:46 AM

                @shgmongohh Ok I’ll take a look at my stuff soon. I’m in the middle of writing another module that takes a photo when this PIR module senses user presence, if you had a camera attached it might be useful to you to see what the pir is detecting, if anything.

                S 1 Reply Last reply Oct 7, 2016, 4:52 AM Reply Quote 0
                • S Offline
                  shgmongohh @jc21
                  last edited by shgmongohh Oct 7, 2016, 4:53 AM Oct 7, 2016, 4:52 AM

                  @jc21
                  Thank you. I don´t have a camera.
                  I don´t know if the sonsor works not correct or if I have another issue.

                  When I install your module, have I to delete or uninstall the other pir-module?
                  I only have renamed the folder.
                  If i have to delete it, how is it done?

                  Sebastian

                  1 Reply Last reply Reply Quote 0
                  • S Offline
                    shgmongohh
                    last edited by Oct 8, 2016, 5:55 PM

                    I have found a python programm, where I can track the sensor in a consolen window. Has anybody an idea how i can safe the data into a document? And how I can autostart my python programm?

                    # Import required Python libraries
                    import RPi.GPIO as GPIO
                    import time
                    import datetime
                    
                    # Use BCM GPIO references
                    # instead of physical pin numbers
                    GPIO.setmode(GPIO.BCM)
                    
                    # Define GPIO to use on Pi
                    GPIO_PIR = 23
                    
                    print "Bewegungsmelder Test (CTRL-C zum Beenden)"
                    print "========================================="
                    
                    # Set pin as input
                    GPIO.setup(GPIO_PIR,GPIO.IN)      # Echo
                    
                    Current_State  = 0
                    Previous_State = 0
                    
                    try:
                    
                      print "%s: Sensor initialisieren ..." % datetime.datetime.now()  
                    
                      # Loop until PIR output is 0
                      while GPIO.input(GPIO_PIR)==1:
                        Current_State  = 0    
                    
                      print "%s: Fertig! Warte auf Bewegung..."  % datetime.datetime.now()    
                        
                      # Loop until users quits with CTRL-C
                      while True :
                       
                        # Read PIR state
                        Current_State = GPIO.input(GPIO_PIR)
                       
                        if Current_State==1 and Previous_State==0:
                          # PIR is triggered
                          print " %s: Bewegung erkannt!" % datetime.datetime.now() 
                          # Record previous state
                          Previous_State=1
                        elif Current_State==0 and Previous_State==1:
                          # PIR has returned to ready state
                          print " %s: Fertig! Warte auf Bewegung..."  % datetime.datetime.now() 
                          Previous_State=0
                          
                        # Wait for 10 milliseconds
                        time.sleep(0.01)      
                          
                    except KeyboardInterrupt:
                      print " Exit"
                      # Reset GPIO settings
                      GPIO.cleanup()
                    S 1 Reply Last reply Oct 9, 2016, 1:29 PM Reply Quote 0
                    • S Offline
                      shgmongohh @shgmongohh
                      last edited by Oct 9, 2016, 1:29 PM

                      It done. I can tune my PIR-Sensor.
                      Here is a usefull Link.

                      1 Reply Last reply Reply Quote 1
                      • 1
                      • 2
                      • 3
                      • 4
                      • 2 / 4
                      2 / 4
                      • First post
                        19/40
                        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