• 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 Motion sensor

Scheduled Pinned Locked Moved Troubleshooting
16 Posts 6 Posters 12.0k Views 7 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.
  • R Offline
    richardh151
    last edited by Aug 1, 2017, 6:27 PM

    Jeff thank you very much, I tried to first suggestion and it worked perfectly. As I said I’m somewhat of a novice and on a steep and again enjoyable learning curve. 😊

    1 Reply Last reply Reply Quote 0
    • R Offline
      richardh151
      last edited by Aug 23, 2017, 9:27 AM

      Im trying to add a LED strip WS2812B to my python script which switches on and off at the same time as my motion sensor is activated. Whilst there are many scripts out there I struggle to incorporate one into what i have that currently works, can anyone help. My LED GPIO Pin is 17. Any help is appreciated

      This is my current script,

      from gpiozero import MotionSensor
      from subprocess import call
      from time import sleep

      Time to wait until display should turn off after last motion detected

      timeUntilDisplayOff = 600

      The GPIO data pin to which the PIR sensor is connected

      pin = 4

      pir = MotionSensor(pin)
      timer = timeUntilDisplayOff

      while True:

      if pir.motion_detected:
      	timer = timeUntilDisplayOff
      	print ("Motion detected! Setting timer to " + str(timer) + " seconds.")
      	
      if timer > 0:
      	if timer % 10 == 0:
      		print ("Timer: " + str(timer) + " seconds")
      	timer -= 1
      
      elif timer == 0:
      	call(['vcgencmd', 'display_power', '0'])
      
      	print ("Timer is 0. Display turned off. Waiting for motion...")
      	# display is now off. we wait for motion and turn it on
      	pir.wait_for_motion()
      	call(['vcgencmd', 'display_power', '1'])
      	timer = timeUntilDisplayOff
      
      sleep(1)
      
      1 Reply Last reply Reply Quote 0
      • K Offline
        Kimzer
        last edited by Aug 23, 2017, 10:21 AM

        Interested in the very same thing! But i am trying to make my HUE light strip turn/on off as the screen already does.

        I found this Hue motion

        R 1 Reply Last reply Aug 23, 2017, 10:46 AM Reply Quote 0
        • R Offline
          richardh151 @Kimzer
          last edited by Aug 23, 2017, 10:46 AM

          @Kimzer thanks but as a novice the suggested scripts blew my mind and seems much more complicated to what I’m currently using. I’m sure there is a way to modify it to switch on the led strip at the same time as the monitor jumps to life from the PIR motion sensor. I have a RPi3 and have it connected but struggle with the script which I’m sure is easy for someone else.

          O 1 Reply Last reply Aug 24, 2017, 1:36 AM Reply Quote 0
          • K Offline
            Kimzer
            last edited by Aug 23, 2017, 4:40 PM

            @Kimzer said in LED Backlight for mirror - PIR to control them:

            Found this hue motion but i couldnt get it to run.
            Anyone that has some input?

            So i managed to do this. Its probably quite a dirty fix. And only setup to work with phillips hue bulbs/strips. But if u want to know shoot me a pm and ill show it. (Y)

            1 Reply Last reply Reply Quote 0
            • O Offline
              orayoflighto Project Sponsor @richardh151
              last edited by Aug 24, 2017, 1:36 AM

              @richardh151

              Have you seen this?
              https://forum.magicmirror.builders/post/26789

              R 3 Replies Last reply Aug 27, 2017, 11:01 AM Reply Quote 0
              • C Offline
                cowboysdude Module Developer @richardh151
                last edited by Aug 24, 2017, 1:54 AM

                @richardh151 Here’s a VERY simple one…

                https://github.com/cowboysdude/Pir-Sensor

                1 Reply Last reply Reply Quote 1
                • R Offline
                  richardh151 @orayoflighto
                  last edited by Aug 27, 2017, 11:01 AM

                  @orayoflighto what you show is exactly what I need, however struggling with MMM pir Sensor module as my MM shows a conf.js error. So can’t get beyond that. I also have the RGB WS2812B led strips which I discovered r more problematic to control. I feel as though I tried many things but still frustrated with non functioning lights.

                  1 Reply Last reply Reply Quote 0
                  • R Offline
                    richardh151 @orayoflighto
                    last edited by Aug 27, 2017, 1:54 PM

                    This post is deleted!
                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      richardh151 @orayoflighto
                      last edited by Aug 31, 2017, 8:08 PM

                      @orayoflighto I’m struggling with MMM PIR Sensor and constantly get a black screen, this is my coming input, can you advise if I’m doing anything obviously wrong, thanks

                      module: ‘MMM-PIR-Sensor’,
                      config: {
                      sensorGpio: 4, // This is the GPIO port number, not the header pin number
                      relayGpio: false, // This is the GPIO port number, not the header pin number
                      powerSaving: true,
                      relayOnState: 1,
                      relayOffState: 0,
                      turnOffAfterSeconds: 30,
                      debug: false
                      }
                      },

                      1 Reply Last reply Reply Quote 0
                      • 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