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.

    {HowTo} turn on/off your monitor (Time based, PIR/Button, App)

    Scheduled Pinned Locked Moved Tutorials
    171 Posts 39 Posters 275.1k Views 54 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.
    • cruunnerrC Offline
      cruunnerr
      last edited by cruunnerr

      try the shell scripts without the python script.

      sh monitor_off.sh should show a black screen (not turning HDMI off)
      sh monitor_on.sh should disable the black screen.

      if this is working for u, then your pir.py script seems not being correct.

      the chmod +x step is necessary for the python script execute the shell scripts.

      But first try the commands above. If this doesn’t work, then i have to think about and search for a solution.
      But i tried it just a few seconds ago, and it works fine here

      H 1 Reply Last reply Reply Quote 0
      • H Offline
        hoofta @cruunnerr
        last edited by

        @cruunnerr for me $ sh monitor_off.sh returns the following
        sh: 0: Can’t open monitor_off.sh
        I then inputted $ nano monitor_off.sh and it’s empty when I just inputted the commands from your instructions. ¯_(ツ)_/¯

        1 Reply Last reply Reply Quote 0
        • cruunnerrC Offline
          cruunnerr
          last edited by cruunnerr

          again one step closer :D

          put in the content and save with “ctrl+x” and “y”

          try everything agin and report if u got trouble again :)

          edit:

          oh sorry. Aren’t we using “screen_on/off”?? :D

          so try

          sh screen_off.sh should show a black screen (not turning HDMI off)
          sh screen_on.sh should disable the black screen.

          1 Reply Last reply Reply Quote 1
          • H Offline
            hoofta
            last edited by

            I GOT IT! I stepped back a few steps with the module removed from the config.js file and it wouldn’t blank anymore so it made me think I had something wrong with the pir.py file.

            I looked into Paviro’s files in the PIR-Sensor folder and found in the node_helper.js file a reference to tvservice -o/p. I found where my xscreensaver was located /usr/bin/ and I had the node_helper file execute the xscreensaver instead of the tvservice.

            Bingo! No more “No Signal” bouncing around when the PIR-Sensor module kicks in! Many thanks to Cruunnerr for the help. Definitely could not have figured this out without you!

            Mykle1M 1 Reply Last reply Reply Quote 1
            • Mykle1M Offline
              Mykle1 Project Sponsor Module Developer @hoofta
              last edited by

              @hoofta

              Good work, mate! I like it. :-)

              Create a working config
              How to add modules

              1 Reply Last reply Reply Quote 0
              • P Offline
                PaulB
                last edited by

                @cruunnerr,

                Thank you so much! What a great ‘How-to’- Guide :)

                You and your post helped a lot. :)

                1 Reply Last reply Reply Quote 1
                • H Offline
                  hnperkins
                  last edited by

                  hey all, im having a issue with my pir module. i have run the pir.py script and its constantly scrolling the … until i move and then it stops for a brief second, and when i load the module in my config file the screen just stays black. is this some kind of interference or do i just have it hooked up backwards or something?

                  randomnoiseR 1 Reply Last reply Reply Quote 0
                  • randomnoiseR Offline
                    randomnoise @hnperkins
                    last edited by

                    @hnperkins if the script is working the opposite way round it could be that you have a pir board which uses inverted signals. The board I had originally worked this way. So when no motion is detected it gives you a 1 & when you move it gives you a 0. Instead of running the script try typing gpio read 0 (substitute the pin number you used here… remember gpio “wiring pi” numbering will be different to the number you input in your file. See https://pinout.xyz/). It only shows the current state so you need to keep putting this in as you move in front of the sensor to test it. Hit up + enter to “retype” the command quickly in the console.

                    If this is the case then unfortunately the script will not work in your case… it’s written for true or 1 to be when movement is detected.

                    If you use paviro’s module there is a configuration option to invert the input pin.

                    As to the screen being black when starting mm. It’s probably an error in your configuration. Search the forum to find info on how to check the config as that has been well covered.

                    H 1 Reply Last reply Reply Quote 1
                    • H Offline
                      hnperkins @randomnoise
                      last edited by

                      @randomnoise ok so when i do the gpio read command it always shows a 1, when i use a pin its not connected to it shows a 0, is this what you were talking about?

                      randomnoiseR 1 Reply Last reply Reply Quote 0
                      • randomnoiseR Offline
                        randomnoise @hnperkins
                        last edited by

                        @hnperkins yes, if it’s always showing a 1 then your sensor is ‘inverted’ to the standard way most pir boards work. Note it should go to 0 when the pir detects movement (you might need to continually wave your hand in front of the pir at the exact moment you hit enter after typing the gpio read to see the 0. If you never see a 0 then you may have a faulty pir).

                        Although I initially did get my ‘inverted’ sensor working using the invert configuration option in paviros module, it eventually stopped working correctly (my mirror would register a false detection every 3 mins or so causing my screen to stay always on). Not sure why it broke… seemed to happen after I upgraded to a newer version of mm, but issue didn’t go away after I tried rolling back. Final thing I did to stop false triggering was to install a ferrite choke on my input wire & to move where my pi sat at the back of my monitor (it was quite close to the monitors power converter initially).

                        Ultimately the way I got it working was to buy a different pir board (the kind with the 2 potentiometers for sensitivity & time adjustment) which also happened to be 0 for no movement & 1 for movement). I then used the pir.py script instead of the module to trigger screen on / off. I was fairly sure it wasn’t a single faulty pir unit (mine came in a pack of 3) but nothing I did got it working so in the end spending an extra fiver on a different type of pir seemed worth it to me.

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