Navigation

    MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    MagicMirror² v2.15.0 is available! For more information about this release, check out this topic.

    SOLVED PIR-Sensor with relay

    Troubleshooting
    2
    4
    345
    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.
    • P
      PottiMc last edited by

      Hi all,

      I try to run a relay which is cutting down the power to my lcd monitor. The PIR-Sensor module works fine as long as i don’t use the relayPin command. I get the following error message in the logs:

      { Error: EPERM: operation not permitted, write
      at Object.fs.writeSync (fs.js:707:3)
      at Gpio.writeSync (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/onoff/onoff.js:243:8)
      at Class.activateMonitor (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_helper.js:27:24)
      at /home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_helper.js:124:30
      at gpio._listeners.slice.forEach.callback (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/onoff/onoff.js:135:9)
      at Array.forEach ()
      at pollerEventHandler (/home/pi/MagicMirror/modules/MMM-PIR-Sensor/node_modules/onoff/onoff.js:134:32) errno: -1, syscall: ‘write’, code: ‘EPERM’ }

      Can somebody tell me what to do?

      S 1 Reply Last reply Reply Quote 0
      • S
        sdetweil @PottiMc last edited by

        @PottiMc i would guess that you have the wrong pin for the relay

        from the onoff library

        Note that EPERM: operation not permitted, write isn't actually related to permissions. An EPERM error occurs when an operation is not permitted because it doesn't make sense. In this case it looks like the EPERM error occurred because an an attempt was made to write data to an input. Here's an example:
        
        pi@raspberrypi:~ $ cd /sys/class/gpio/
        pi@raspberrypi:/sys/class/gpio $ echo 17 > export 
        pi@raspberrypi:/sys/class/gpio $ cd gpio17
        pi@raspberrypi:/sys/class/gpio/gpio17 $ echo in > direction 
        pi@raspberrypi:/sys/class/gpio/gpio17 $ echo 1 > value 
        -bash: echo: write error: Operation not permitted
        pi@raspberrypi:/sys/class/gpio/gpio17 $ 
        Errors related to permissions are usually EACCES errors.
        
        1 Reply Last reply Reply Quote 0
        • P
          PottiMc last edited by

          Thank you. I managed it! The problem was that my start script didn’t switch the gpio to output correctly. You gave me the right direction.

          S 1 Reply Last reply Reply Quote 0
          • S
            sdetweil @PottiMc last edited by

            @PottiMc awesome… glad it worked out

            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 Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy