• 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.

PIR-Sensor - put your mirror to sleep if not used

Scheduled Pinned Locked Moved Troubleshooting
126 Posts 37 Posters 195.3k Views 20 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.
  • P Offline
    paviro Admin @jrleeman
    last edited by paviro May 13, 2016, 1:26 PM May 13, 2016, 1:25 PM

    @jrleeman feel free to send a pull request! :) the sensor I use cost 3€ do I don’t really see a reason to do it in software of the sensors are that cheap :smiley:

    We're all stories in the end. Just make it a good one, eh?

    – The Doctor

    J 1 Reply Last reply May 13, 2016, 1:32 PM Reply Quote 0
    • J Offline
      jrleeman @paviro
      last edited by May 13, 2016, 1:32 PM

      @paviro Fair enough. I’ll see which I find easier, code or hardware. :smiley:

      N 1 Reply Last reply Jan 24, 2017, 8:49 PM Reply Quote 0
      • S Offline
        sjuulbosmans
        last edited by May 13, 2016, 4:02 PM

        @paviro
        Thanks for making this module. I am experiencing the same issue as @incubik as my screen turns white when I start the MM. My PIR sensor works as I tested it on the R Pi and with some LEDs and my breadboard. I have reinstalled the MM and this module but I can’t seem to get it working. I have also no idea what causes this. Do you have any thought on this?
        Thanks

        P 1 Reply Last reply May 13, 2016, 5:00 PM Reply Quote 0
        • P Offline
          paviro Admin @sjuulbosmans
          last edited by May 13, 2016, 5:00 PM

          @sjuulbosmans white and black screens are mostly caused by wrong configuration. Check your web inspector!

          We're all stories in the end. Just make it a good one, eh?

          – The Doctor

          1 Reply Last reply Reply Quote 0
          • I Offline
            incubik
            last edited by May 14, 2016, 2:00 AM

            I’ve tried to check the web inspector but when the screen is white… problems ahead —> The web inspector doesn’t pop up.

            I’ve tried this without installing the PIR Sensor module and the web inspector works but again when the screen is in “white mode” doesn’t.

            Any thoughts?

            P 1 Reply Last reply May 14, 2016, 8:11 AM Reply Quote 0
            • P Offline
              paviro Admin @incubik
              last edited by May 14, 2016, 8:11 AM

              @incubik try the serveronly mode (see the wiki) :)

              We're all stories in the end. Just make it a good one, eh?

              – The Doctor

              1 Reply Last reply Reply Quote 0
              • I Offline
                IngmarSwart
                last edited by paviro May 15, 2016, 10:51 AM May 15, 2016, 10:48 AM

                First of all: @paviro, many thanks for this module.

                I ran into some troubles with the module and thought I should share this (and my solution) here.
                Problem:
                Without the PIR module, everything worked as it should. After installing the PIR module, everything appeared fine and the (HDMI) monitor switched off after a given amount of time (set via a variable resistance on the sensor itself). Upon motion detection by the PIR, the monitor switched back on but didn’t display anything (I could tell the monitor was on from the backlight). Remote access via ssh was not affected.
                In the end, I figured out that this was due to an incorrect setting of the virtual terminal. Typing ‘sudo chvt 9 && sudo chvt 7’ on the remote terminal brought the image back to the monitor connected to the RasPi. After stopping the mirror, modifying the ‘activateMonitor’ function in ‘node_helper.js’ as below, and restarting the mirror, the problem was solved. I hpe this is helpful to others.

                Modified section of ‘node_helper.js’:

                activateMonitor: function () {
                    if (this.config.relayPIN != false) {
                      gpio.digitalWrite(this.config.relayPIN, this.config.relayOnState)
                    }
                    else if (this.config.relayPIN == false){
                      exec("/opt/vc/bin/tvservice -p", null);
                      exec("/usr/bin/sudo /bin/chvt 9 && /usr/bin/sudo /bin/chvt 7 ", null);
                    }
                

                PS: There may be more elegant solutions to this, but I my node.js skills are, shall we say, limited?

                P 1 Reply Last reply May 15, 2016, 10:51 AM Reply Quote 0
                • P Offline
                  paviro Admin @IngmarSwart
                  last edited by paviro May 15, 2016, 10:53 AM May 15, 2016, 10:51 AM

                  @IngmarSwart could you explain what setting this changes? And may open a pull request? Is this only possible with sudo?

                  Please also note: Use Markdown on code snippets so it is easier to read!

                  We're all stories in the end. Just make it a good one, eh?

                  – The Doctor

                  1 Reply Last reply Reply Quote 0
                  • I Offline
                    IngmarSwart
                    last edited by May 15, 2016, 11:27 AM

                    @paviro, if I understoof the documentation correctly, the command chvt simply changes the foreground terminal. It appears that in my case the the output of the RasPi is send to another terminal than that is displayed on the monitor.

                    My apologies for not using the markdown code. I only recently started using GitHub etc, so I have some learning to do when it comes to opening pull requests.

                    I just tested to confirm if the use of sudo is required. Unfortunately, it is.

                    P 1 Reply Last reply May 15, 2016, 11:29 AM Reply Quote 0
                    • P Offline
                      paviro Admin @IngmarSwart
                      last edited by May 15, 2016, 11:29 AM

                      @IngmarSwart Strange that you have this issue, since I do not. I only have the problem when the monitor is disabled via a relay while the Pi boots.
                      Could you do some more research on why this is happening and maybe find a way to fix it without root rights?

                      We're all stories in the end. Just make it a good one, eh?

                      – The Doctor

                      I 1 Reply Last reply May 19, 2016, 8:31 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 7
                      • 12
                      • 13
                      • 5 / 13
                      5 / 13
                      • First post
                        41/126
                        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