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.

    Can't get MMM-Buttons module working with a physical button

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    4 Posts 2 Posters 328 Views 2 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
      renardroux
      last edited by

      Loving MagicMirror so far! I built a picture frame for my wife using a Raspberry Pi 4 and a random screen that was laying around. Got it working with MMM-GooglePhotos so we can drop pictures into a shared folder and have them show up, MMM-Pir to turn the screen off when nobody is around and back on when somebody walks in, MMM-MoonPhase, and the default calendar and weather modules. I’m trying to use the MMM-Buttons module to use a momentary push switch to hide all of the modules I have normally displayed and show MMM-Breathwork in the center of the screen for one minute. Breathwork works fine permanently displayed with the rest of the modules.

      So, I’ve got the switch hooked up to GPIO 24 and ground, but can’t get any reaction using the button. I’ve been trying to test it with the example setup and MMM-Remote-Control. It looks like this:

      {
          module: "MMM-Buttons",
          config: {
              buttons: [
                  {
                      pin: 24,
                      name: "monitor_control",
                      longPress: [
                          {
                              notification: "REMOTE_ACTION",
                              payload: {action: "MONITOROFF"}
                          }
                      ],
                      shortPress: [
                          {
                              notification: "REMOTE_ACTION",
                              payload: {action: "MONITORTOGGLE"}
                          }
                      ]
                  },
              ]
          }
      },
      

      I have found an error in the logs and tried unsuccessfully to sort it out.

      0|MagicMir |     at new Gpio (/home/magicmirror2/MagicMirror/modules/MMM-Buttons/node_modules/onoff/onoff.js:172:36)
      0|MagicMir |     at Class.intializeButton (/home/magicmirror2/MagicMirror/modules/MMM-Buttons/node_helper.js:89:19)
      0|MagicMir |     at Class.intializeButtons (/home/magicmirror2/MagicMirror/modules/MMM-Buttons/node_helper.js:105:18)
      0|MagicMir |     at Class.socketNotificationReceived (/home/magicmirror2/MagicMirror/modules/MMM-Buttons/node_helper.js:28:18)
      0|MagicMir |     at Socket.<anonymous> (/home/magicmirror2/MagicMirror/js/node_helper.js:91:10)
      0|MagicMir |     at Socket.onevent (/home/magicmirror2/MagicMirror/node_modules/socket.io/dist/socket.js:462:26)
      0|MagicMir |     at Socket._onpacket (/home/magicmirror2/MagicMirror/node_modules/socket.io/dist/socket.js:430:22)
      0|MagicMir |     at /home/magicmirror2/MagicMirror/node_modules/socket.io/dist/client.js:214:24
      0|MagicMir |     at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
      0|MagicMir |   errno: -22,
      0|MagicMir |   code: 'EINVAL',
      0|MagicMir |   syscall: 'write'
      0|MagicMir | } 
      

      So it appears to have to do with onoff. At some point in my several hours of troubleshooting I also found this error:

      The module '/home/magicmirror2/MagicMirror/modules/MMM-Buttons/node_modules/epoll/build/Release/epoll.node'
      was compiled against a different Node.js version using
      NODE_MODULE_VERSION 131. This version of Node.js requires
      NODE_MODULE_VERSION 128. Please try re-compiling or re-installing
      the module (for instance, using npm rebuild or npm install). 
      

      I resorted to having ChatGTP try and help me, but it seemed to be working off of old information as it suggested node.js version 16 and I see 20 or 22+ now. I have 20 installed. I also tried 22 and 23. I did re-install epoll and MMM-Buttons dependencies and stuff.

      Any help would be greatly appreciated. I’m just a tinkerer and not a programmer or anything, so the fix may be obvious to someone more knowledgeable in this sort of thing than me. If the answer is wait for an update to come out from someone or another I’m perfectly fine with that, but figured I’d ask and maybe get a fix or at least the knowledge that an update will come out at some point. Thanks!

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

        @renardroux sadly, the os guys have changed the way gpio works in bookworm.

        i do not know what needs to be done, but its fairly extensive

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          renardroux @sdetweil
          last edited by

          @sdetweil The good news there is that it sounds like I can just install a Bullseye image and maybe be good to go! Thanks! We’ll see how much I wanna get that button going.

          I will say that MMM-Pir uses GPIO successfully in “mode: 0 - use node-libgpiod library” and “mode: 1 - use python script with gpiozero library.” Don’t know if that information could help sort out MMM-Buttons.

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

            @renardroux yes, that is the kind of work required

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            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