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.

    Bugsounet and MMM-Pir

    Scheduled Pinned Locked Moved General Discussion
    68 Posts 10 Posters 23.7k Views 11 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
      sdetweil @lif
      last edited by

      @lif and you are using the correct pin definition

          Pir: {
            mode: 0,
            gpio: 21
          },
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      L 2 Replies Last reply Reply Quote 0
      • L Offline
        lif @sdetweil
        last edited by

        @sdetweil said in Bugsounet and MMM-Pir:

        @lif and you are using the correct pin definition

            Pir: {
              mode: 0,
              gpio: 21
            },
        

        Yes, the working script is:
        from gpiozero import MotionSensor
        from datetime import datetime
        import os, time
        import RPi.GPIO as GPIO

        pir = MotionSensor(21)
        while True:

            pir.wait_for_motion()
            now = datetime.now()
            current_time = now.strftime("%H:%M:%S")
            print("Movement detected at", current_time)
            pir.wait_for_no_motion()
        
        S 1 Reply Last reply Reply Quote 0
        • S Offline
          sdetweil @lif
          last edited by

          @lif I meant MMM-PIR config setup

          there are different numbering schemes for GPIO pins and different ways to access

          the doc (readme) describes the different choices.

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • L Offline
            lif @sdetweil
            last edited by

            @sdetweil said in Bugsounet and MMM-Pir:

            @lif and you are using the correct pin definition

                Pir: {
                  mode: 0,
                  gpio: 21
                },
            

            Yes, I think so, the pir is connected to pin 40 on the Raspberry pi 3b which I’m sure is GPIO 21

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @lif
              last edited by

              @lif and if you change to mode 1?? which matches your python lib test?

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              L 1 Reply Last reply Reply Quote 0
              • L Offline
                lif @sdetweil
                last edited by

                @sdetweil said in Bugsounet and MMM-Pir:

                @lif and if you change to mode 1?? which matches your python lib test?

                No difference.

                I have added a header: “PIR”, line before the config and that is not showing either.

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @lif
                  last edited by

                  @lif are there any errors listed in the MM startup messages??

                  if using pm2 to auto start

                  pm2 logs --lines =xxx

                  xxx is number of most recent lines to display, default 15,
                  usually need 100 or more for full message list

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  L 1 Reply Last reply Reply Quote 0
                  • L Offline
                    lif @sdetweil
                    last edited by

                    @sdetweil said in Bugsounet and MMM-Pir:

                    @lif are there any errors listed in the MM startup messages??

                    if using pm2 to auto start

                    pm2 logs --lines =xxx

                    xxx is number of most recent lines to display, default 15,
                    usually need 100 or more for full message list

                    Thanks for all your help
                    I think this line might be relevant
                    0|mm | [2025-03-24 16:54:30.994] [WARN] No /home/pi/MagicMirror/js/…/modules/MMM-Pir/MMM-Pir.js found for module: MMM-Pir.

                    It’s correct, there isn’t a MMM-Pir.js file in the MMM-Pir directory.

                    S R F 3 Replies Last reply Reply Quote 0
                    • S Offline
                      sdetweil @lif
                      last edited by

                      @lif module rules

                      module name (exact case) = folder name in modules folder
                      MUST contain at minimum a file name that matches(exact case) of the modulename.js

                      AND inside that file it MUST contain a module.register(name…)
                      where name MUST match (exact case) the module name

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • R Offline
                        rkorell Module Developer @lif
                        last edited by rkorell

                        @lif said in Bugsounet and MMM-Pir:

                        It’s correct, there isn’t a MMM-Pir.js file in the MMM-Pir directory

                        If you had cloned this repository from @coernel - the MMM-pir.js is missing.
                        This must be an error.

                        Nevertheless: I’ve played around with the original version from bugsounet and figured out that editing his “origin” MM-Pir.js was really hard because he has deleted all linefeeds.
                        Seeking around I found an editable clone of the *.js files (including node_helper) in the src folder of the repository.
                        This is true for the new clone from coernel …
                        give it a try :-)

                        Regards,
                        Ralf

                        S R 2 Replies Last reply Reply Quote 0
                        • S Offline
                          sdetweil @rkorell
                          last edited by

                          @rkorell said in Bugsounet and MMM-Pir:

                          Nevertheless: I’ve played around with the original version from bugsounet and figured out that editing his “origin” MM-Pir.js was really hard because he has deleted all linefeeds.

                          called minified

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          R 1 Reply Last reply Reply Quote 1
                          • R Offline
                            rkorell Module Developer @sdetweil
                            last edited by

                            @sdetweil said in Bugsounet and MMM-Pir:

                            called minified

                            :-) never seen this before…
                            Called minified - for good reasons …

                            S 1 Reply Last reply Reply Quote 0
                            • S Offline
                              sdetweil @rkorell
                              last edited by

                              @rkorell said in Bugsounet and MMM-Pir:

                              Called minified - for good reasons …

                              On a production web site with 1000000’s of file loads, minified can reduce response times…

                              otherwise it is a hiding technique, which can(has) hidden hacker attacks on client systems…(loading files, sending credentials…)
                              hard to examine code

                              Sam

                              How to add modules

                              learning how to use browser developers window for css changes

                              R 1 Reply Last reply Reply Quote 0
                              • R Offline
                                rkorell Module Developer @sdetweil
                                last edited by rkorell

                                @sdetweil said in Bugsounet and MMM-Pir:

                                hard to examine code

                                Yes, I guess this was bugsounet’s intention - irritating beginners :-)

                                The code has 247 lines so you avoid 247 CR’s - not THAT much more efficient, I think - but on 100eds of 1000nds of files - may be …

                                Ralf

                                S 1 Reply Last reply Reply Quote 0
                                • S Offline
                                  sdetweil @rkorell
                                  last edited by

                                  @rkorell he did not do it for performance

                                  Sam

                                  How to add modules

                                  learning how to use browser developers window for css changes

                                  R 1 Reply Last reply Reply Quote 1
                                  • R Offline
                                    rkorell Module Developer @sdetweil
                                    last edited by

                                    @sdetweil I agree :-)

                                    1 Reply Last reply Reply Quote 0
                                    • R Offline
                                      rkorell Module Developer @rkorell
                                      last edited by rkorell

                                      @rkorell said in Bugsounet and MMM-Pir:

                                      in the src folder of the repository

                                      @lif , @coernel :
                                      there are several files missing in coernels upload.
                                      I’ve just checked source code in MMM-Pir.js …

                                            "/modules/MMM-Pir/components/screenDisplayer.js",
                                            "/modules/MMM-Pir/components/screenTouch.js",
                                            "/modules/MMM-Pir/node_modules/long-press-event/dist/long-press-event.min.js",
                                            "/modules/MMM-Pir/node_modules/progressbar.js/dist/progressbar.min.js",
                                            "/modules/MMM-Pir/components/motion.js",
                                            "/modules/MMM-Pir/components/motionLib.js"
                                      

                                      The complete folder MMM-Pir/node_modules is missing.
                                      The folder MMM-Pir/components/ contains only the python script for PIR communication, none of the above *.js files.

                                      At least the /components/*.js files are present in the components folder of MMM-Pir/src …

                                      But this seems to be a frickling job to get this done.
                                      I guess a complete upload of an original MMM-Pir installation would be the better way.

                                      What do you think?

                                      Regards,
                                      Ralf

                                      S 1 Reply Last reply Reply Quote 0
                                      • S Offline
                                        sdetweil @rkorell
                                        last edited by

                                        @rkorell because they are in node_modules they were dependencies , not part of the actual module…

                                        Sam

                                        How to add modules

                                        learning how to use browser developers window for css changes

                                        R 1 Reply Last reply Reply Quote 0
                                        • R Offline
                                          rkorell Module Developer @sdetweil
                                          last edited by rkorell

                                          @sdetweil said in Bugsounet and MMM-Pir:

                                          not part of the actual module…

                                          As far as I understood @coernel tried to re-upload bugsounet’s MMM-Pir.
                                          And this modules uses all of these dependencies.
                                          And the original MMM-Pir.js from bugsounet is missing as well in coernel’s re-upload, so it will never work - which is, what @lif has experienced …
                                          So my above suggestion was - if it is intended to have a working copy of bugsounet’s module - to re-investigate the re-uploaded version because there is missing a lot - as mentioned even the core *.js file in the root of the module…

                                          If useful for anybody I’ve created a complete copy of my own working module-directory and uploaded it here for your attention/action.
                                          Please ignore some additional files which I have kept as copies of the original files I had modified.

                                          Hope this is clearer now :-)

                                          Regards,
                                          Ralf

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Offline
                                            sdetweil @rkorell
                                            last edited by

                                            @rkorell yes, i posted a warning early after he left to save what you could, without knowing the details of such work effort

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            R 1 Reply Last reply Reply Quote 1

                                            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
                                            • 3
                                            • 4
                                            • 2 / 4
                                            • 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