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 36.9k 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.
    • S Offline
      shgmongohh
      last edited by

      Hi,

      I have sucessfully installed the PIR-Sensor. Now I want to tune the Sensor. Is there a possibility to track, when the monitor is turned off?
      I want to adjust the delay time and the distance.

      Sebastian

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        Jopyth Moderator @shgmongohh
        last edited by Jopyth

        @shgmongohh Does you sensor have these turn knobs, to adjust distance and time delay? Like here? Lets hope it does, all you need to do then, is turn them until the delay + distance work fine.

        Helpful sticky: How to troubleshoot

        S 1 Reply Last reply Reply Quote 0
        • S Offline
          shgmongohh @Jopyth
          last edited by

          @Jopyth
          Yes, it has the knobs. But I want a programm which logged the time, when the monitor starts or shut down.
          I unfortunatly cann´t programm it, because I don´t have the knowledge.

          Sebastian

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            Jopyth Moderator @shgmongohh
            last edited by Jopyth

            @shgmongohh And you want this, to adjust delay and distance accordingly? I have used a simple python program for that, maybe I can find it again.

            Edit: Never mind, but if you just want to know, when the sensor goes off or on this tutorial might help.

            Helpful sticky: How to troubleshoot

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              shgmongohh @Jopyth
              last edited by

              @Jopyth
              I will try it.
              I want to know if for example the monitor stays off during the night. I have the feeling, that he sometimes turns on when nobody is around. Thats the reason I want to trigger the on/off time.
              When I have the times I can also adjust the minutes he stays on with the knob.

              Sebastian.

              1 Reply Last reply Reply Quote 0
              • S Offline
                shgmongohh
                last edited by

                Can anybody tell me, how to write a python programm to trigger the on / off time of the monitor? My monitor starts during the night. I want to now how often he starts.

                Sebastian

                J 1 Reply Last reply Reply Quote 0
                • J Offline
                  jc21 @shgmongohh
                  last edited by

                  @shgmongohh I have forked the original MMM-Pir-Sensor repo and made some mods to debug my own sensor last week.

                  https://github.com/jc21/MMM-PIR-Sensor

                  If you add debug: true to the config of my forked code, you’ll get console info about when the sensor detects motion and when it doesn’t. Also note, I’ve renamed the sensorPIN config item to sensorGpio to more accurately indicate the numeric determination.

                  [MMM-PIR] [2016-10-04 09:31:07] Watching on GPIO #25 ...
                  [MMM-PIR] [2016-10-04 09:34:15] Motion no longer detected
                  [MMM-PIR] [2016-10-04 09:34:15] Turning Screen OFF in 30 seconds
                  [MMM-PIR] [2016-10-04 09:34:18] Motion detected
                  [MMM-PIR] [2016-10-04 09:34:18] Not turning monitor ON, its already ON
                  
                  S 2 Replies Last reply Reply Quote 1
                  • S Offline
                    shgmongohh @jc21
                    last edited by

                    @jc21
                    Thanks alot for your help. I was on vacation and will try it now.

                    Sebastian

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      shgmongohh @jc21
                      last edited by

                      @jc21 said in MMM-PIR-Sensor tuning:

                      debug: true

                      One stupid question, how is the debug info started?

                      1 Reply Last reply Reply Quote 0
                      • KirAsh4K Offline
                        KirAsh4 Moderator
                        last edited by

                        As @jc21 suggested, add the line debug: true to the module’s config section, and restart MM, then look at the console log.

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

                        S 1 Reply Last reply Reply Quote 0
                        • S Offline
                          shgmongohh @KirAsh4
                          last edited by

                          @KirAsh4 said in MMM-PIR-Sensor tuning:

                          I have add the line to the config section. My question is, how can I look at the console log, when I have start the mm new.
                          Have I go to a special folder, have I to put something in the consule?

                          pi@raspberrypi:~ $ pm2 stop mm
                          [PM2] Applying action stopProcessId on app [mm](ids: 0)
                          [PM2] [mm](0) ✓
                          ┌──────────┬────┬──────┬─────┬─────────┬─────────┬────────┬────────┬──────────┐
                          │ App name │ id │ mode │ pid │ status  │ restart │ uptime │ memory │ watching │
                          ├──────────┼────┼──────┼─────┼─────────┼─────────┼────────┼────────┼──────────┤
                          │ mm       │ 0  │ fork │ 0   │ stopped │ 0       │ 0      │ 0 B    │ disabled │
                          └──────────┴────┴──────┴─────┴─────────┴─────────┴────────┴────────┴──────────┘
                           Use `pm2 show <id|name>` to get more details about an app
                          pi@raspberrypi:~ $ pm2 start mm
                          [PM2] Applying action restartProcessId on app [mm](ids: 0)
                          [PM2] [mm](0) ✓
                          [PM2] Process successfully started
                          ┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬────────────┬────────   ──┐
                          │ App name │ id │ mode │ pid  │ status │ restart │ uptime │ memory     │ watchin   g │
                          ├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼────────────┼────────   ──┤
                          │ mm       │ 0  │ fork │ 1246 │ online │ 0       │ 0s     │ 2.262 MB   │ disable   d │
                          └──────────┴────┴──────┴──────┴────────┴─────────┴────────┴────────────┴────────   ──┘
                           Use `pm2 show <id|name>` to get more details about an app
                          pi@raspberrypi:~ $
                          

                          So, what next?

                          Sebastian

                          1 Reply Last reply Reply Quote 0
                          • KirAsh4K Offline
                            KirAsh4 Moderator
                            last edited by

                            You need the browser’s console log. I forgot how to pull it up in Electron, but a search on the forums should give you an answer. Alternatively, you can open your favorite browser on a different machine (on the same network) and visit the rpi’s ip and MM’s port, like so: http://rpi_ip:8080 (fill in rpi_ip). Then hit F12 on the browser to open the console panel.

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

                            J 1 Reply Last reply Reply Quote 0
                            • J Offline
                              Jopyth Moderator @KirAsh4
                              last edited by Jopyth

                              @KirAsh4 actually it looks like most of the Debug log will appear on the server side.

                              You can check this with ‘pm2 logs mm’. Add ‘–lines 100’ to show more off the logs (100) in this case.

                              Helpful sticky: How to troubleshoot

                              1 Reply Last reply Reply Quote 0
                              • KirAsh4K Offline
                                KirAsh4 Moderator
                                last edited by

                                Most being the keyword, not all. And honestly, when I’m developing, I don’t rely on what pm2 is telling me, but rather specifically what the browser sees (or doesn’t) and where the errors lie. pm2 doesn’t do that. I can get all errors and debug messages in one place: the browser’s console log. I don’t need to open yet another window just to look at pm2’s logs.

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

                                J 1 Reply Last reply Reply Quote 0
                                • J Offline
                                  Jopyth Moderator @KirAsh4
                                  last edited by Jopyth

                                  @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
                                  • KirAsh4K Offline
                                    KirAsh4 Moderator
                                    last edited by

                                    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

                                      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 Reply Quote 0
                                      • S Offline
                                        shgmongohh @jc21
                                        last edited by

                                        @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

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

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Offline
                                            shgmongohh @jc21
                                            last edited by

                                            @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 Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 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