text: Instead of running them separately, I want to combine them. I got this much running but want to know if there are any necessary "cleanups" that should be done.
  You can see the last "if GPIO.input(7)" stuff is just the PIR dropped on the end. I moved all the pin assignments to the top. Once I did that It all started working and I haven't done anything since.
  Code: Select all
  import requests import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setwarnings(False) r = requests.post("") # Door monitor notification r = requests.post("") # Motion monitor notification buttonRDPin = 15 # This pin is not connected, just a placeholder buttonRUPin = 16 buttonLDPin = 38 # This pin is not connected, just a placeholder buttonLUPin = 40 GPIO.setup(buttonRUPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(buttonRDPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Again, just a placeholder GPIO.setup(buttonLUPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.setup(buttonLDPin, GPIO.IN, pull_up_down=GPIO.PUD_UP) # Again, just a placeholder ledONPin = 32 # Light on breadboard advising of service started GPIO.setup(ledONPin, GPIO.OUT) GPIO.output(ledONPin, GPIO.HIGH) GPIO.setup(7, GPIO.IN) # PIR input llogic = 1 # These don't seem to do anything. rlogic = 1 # Not gonna delete them because this all works. while True: buttonState = GPIO.input(buttonRUPin) if buttonState == False: if rlogic == 0: r = requests.post("") rlogic = 1 else: if rlogic == 1: r = requests.post("") rlogic = 0 buttonState = GPIO.input(buttonLUPin) if buttonState == False: if llogic == 0: r = requests.post("") llogic = 1 else: if llogic == 1: r = requests.post("") llogic = 0 if GPIO.input(7): r = requests.post("") # Motion detected time.sleep(15) time.sleep(0.1)
  What I get now is two notifications on my phone, letting me know that garage doors and motion are being monitored. I may consolidate that down to one notification (this is done by Tasker in my phone). I also get notifications when either garage door is opened or closed, or if there is motion in the garage. This is the function that I want.
  I expect to be adding at least 4 more PIR sensors and 3 more door switches to this, so any advice on where or how they should be added would be appreciated. The only GPIOs I am really using now are 32, 40, 16, and 7 (board numbering).