Design Details3. Raspberry Pi 4Raspberry Pi 4 OSSafe Power Down /usr/local/bin/listen_for_shutdown.py #!/usr/bin/python import RPi.GPIO as GPIO import subprocess GPIO.setmode(GPIO.BCM) GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP) GPIO.wait_for_edge(20, GPIO.FALLING) subprocess.call(['shutdown', '-h', 'now'], shell=False)