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.

    MMM-PIR-Sensor with RelayPin and execute script

    Scheduled Pinned Locked Moved Troubleshooting
    9 Posts 3 Posters 4.7k Views 3 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.
    • B Offline
      Blackmirror @nogE
      last edited by

      @nogE
      The MMM-PIR-Sensor module have not work at me.

      So i make a new datei this the name PIR.py in my home - ordner.
      And add python PIR.py in the rc.local
      After this was switch the PIR on the GPIO-Pin 13 the relay-pin 37. Add pin 32 i have a button to open the relay manual.

      1 Reply Last reply Reply Quote 0
      • nogEN Offline
        nogE
        last edited by

        when execute the python script (python /home/pi/scripts/light.py), i got following error:

        File “/home/pi/scripts/light.py”, line 22
        read = GPIO.input(PIR_GPIO)

        1 Reply Last reply Reply Quote 0
        • nogEN Offline
          nogE
          last edited by

          Hi,

          i got an error when i run python script. now the whole error message:

          File “/home/pi/scripts/light.py”, line 22
          read = GPIO.input(PIR_GPIO)
          ^
          IndentationError: expected an indented block

          thx

          yawnsY 1 Reply Last reply Reply Quote 0
          • yawnsY Offline
            yawns Moderator @nogE
            last edited by

            @nogE
            Python is a bit tricky. Unlike other languages python needs proper indentation. Make sure you don’t mix up tabs and whitespaces. Best practice is to use 4 whitespaces instead of one tab.

            1 Reply Last reply Reply Quote 0
            • B Offline
              Blackmirror
              last edited by

              Yes, the error code says, you have not enought whitespaces before the lines.

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