• 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 System
utilitygpiomotion-sensorpower-saving
56 Posts 32 Posters 97.0k Views 47 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.
  • F Offline
    FlatPepsi
    last edited by Feb 25, 2017, 3:17 PM

    I don’t yet have my PIR sensor (soon!), but had a question.
    When the mirror is unused, with the monitor off, it doesn’t make sense to do frequent updates on all of the modules. I could tune those way back, if I could force a refresh on all modules when the PIR triggers a monitor wake-up.

    Is there an easy way to trigger a refresh of some/all modules when the PIR module senses a wake-up event?

    J 1 Reply Last reply Feb 26, 2017, 8:15 PM Reply Quote 0
    • J Offline
      Jopyth Moderator @FlatPepsi
      last edited by Jopyth Feb 26, 2017, 8:15 PM Feb 26, 2017, 8:15 PM

      @FlatPepsi I have implemented this to a few of my own modules, and it is relatively simple to add, depending on which modules you want to adapt. However it will require some fiddling with the code of the modules.

      Helpful sticky: How to troubleshoot

      F S 2 Replies Last reply Feb 26, 2017, 8:20 PM Reply Quote 0
      • F Offline
        FlatPepsi @Jopyth
        last edited by FlatPepsi Feb 26, 2017, 8:22 PM Feb 26, 2017, 8:20 PM

        @Jopyth OK, I’m game. Can you share how that would work?

        I just saw a module to play a sound on events- maybe I could also add a cool sound when the monitor wakes/sleeps. Either a Disney-style magic sound, or a StarTrek computer sound…

        J 1 Reply Last reply Feb 26, 2017, 8:25 PM Reply Quote 0
        • J Offline
          Jopyth Moderator @FlatPepsi
          last edited by Feb 26, 2017, 8:25 PM

          @FlatPepsi I have made a helper function here. This basically works like a normal setInterval, except it stops, when noone is present, and immediately exectues when a someone comes back. The helper functions for this are here, you can probably just copy and paste them. And then you finally need to check incoming notifications like this.

          Helpful sticky: How to troubleshoot

          1 Reply Last reply Reply Quote 1
          • M Offline
            MobbareKurtZ
            last edited by Apr 10, 2017, 8:01 PM

            Thanks for this awesome module, works like a charm!

            I have one question though, would it be possible in some way to make the sensor inactive a specific time of the day? So that the screen won’t turn on no matter what.

            1 Reply Last reply Reply Quote 1
            • F Offline
              fox
              last edited by Apr 28, 2017, 2:43 PM

              Does the problem has known issues with MMM-Remote? Even if i once edit the powerDelay with MMM-Remote it breaks the config file.
              Any other module works with the Remote module.

              Could you please check this?

              Issues With MMM-WatchDog known?

              https://forum.magicmirror.builders/post/29827

              Useful for PIR-Sensor: https://forum.magicmirror.builders/post/21299

              1 Reply Last reply Reply Quote 0
              • K Offline
                Klinge
                last edited by May 31, 2017, 10:20 AM

                @paviro
                Hi,
                I need some help please, because my PIR-Sensor doesn´t work with your module.
                I do not know what I did wrong. I wrote my Problem in another category in the MM Forum, but unfortunately until now nobody could help me.

                My problem is that my monitor does not turn off. I configured the config.js like this

                            module: 'MMM-PIR-Sensor',
                            config: {
                                    sensorPIN: 23,
                                    powerSaving: true,  
                

                and connect the sensor to the raspberry like this
                https://www.tutorials-raspberrypi.de/wp-content/uploads/pir.png

                Waiting about one, two minutes, but the monitor does not turn off. I would be really happy if you could help me.

                Thanks in advance.

                1 Reply Last reply Reply Quote 0
                • R Offline
                  randomnoise
                  last edited by Jun 19, 2017, 8:08 PM

                  @paviro Cheers for making a very useful module.

                  I have made some modifications to node.js to make it work in my situation. I’ve never really done any javascript programming, so what I did was kind of hacked together from various forums. As you know what you’re doing it would be great if you could include any of these features for future versions (I’ve never used GIT before so not sure how to fork etc).

                  I had to make the following modifications-

                  1. Use the vcgencmd function to turn on/off screen (I couldn’t get it to wake up using tvservice despite trying many variations found online). I found this option suggested by others on the forum. Perhaps a config option to use this in place of the TV service for those who it doesn’t work for?
                  2. The PIR sensor I used is not the same as that used by nearly everyone else (the ones I bought are Wingoneer… they come on a smaller board & don’t have the sensitivity adjustments)… the outcome of this is that the sensor pin is high (+5V) when there is no detection & pulled low (0V) when you move in front of sensor. I therefore had to invert your motion detected logic by swapping the 1 & 0. Could an option for ‘invert pin’ be included?
                  3. I followed various options online for how to disable the screen saver… but my pi still goes in to screen save mode after 30 mins. This means even if motion is detected, the screen switches on but remains blank. I solved this in a bit of a hacky way by using the xdotool package to simulate pressing “space” and therefore end the screensaver.
                  4. One final issue which I haven’t been able to resolve yet is that after restarting my PI, assuming there is no motion detected, the screen will be ‘On’ even though there is no motion detected. As an event is not generated (i.e the state didn’t change) it will stay on until the sensor has detected someone & then moved away. Although this isn’t really a huge deal (it should only be restarted if I’m using the screen so I can trigger an event by moving in front & away again) I just wondered if there is a way to do an initial poll of the sensor after start up. I’m not sure if this is because my sensor logic is inverted or if this behaviour is seen on those using the normal PIRs.

                  As I understand I will lose these changes if you upgrade your module next time I do a GIT pull.

                  My code below if it is of interest to anyone:

                  switch off

                  exec("vcgencmd display_power 0"); //Used in favour of tvservice
                  

                  switch on

                  exec("vcgencmd display_power 1"); //Used in favour of tvservice
                  exec("xdotool key space"); //simulate  spacebar to disable screensaver. Needs xdotool to be installed
                  
                  S 1 Reply Last reply Jul 17, 2019, 12:42 AM Reply Quote 0
                  • B Offline
                    BanksyPaint
                    last edited by Aug 14, 2017, 3:37 PM

                    Hi! I’ve run through the posts - though I haven’t been able to find anybody that’s had the sample problem that I’ve had. To test the hardware, I put a towel over the IR sensor, and I find that the monitor flickers on and off, even when the sensor is covered.

                    Has anybody had this issue? Or can suggest some solutions?

                    Thanks!

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      Kimzer
                      last edited by Aug 22, 2017, 12:33 PM

                      Anyway this can send a signal to openhab to control the lights ive put around my frame?

                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 5
                      • 6
                      • 5 / 6
                      • 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