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.

    struggle with MMM-Remote-Control and MMM-Buttons

    Scheduled Pinned Locked Moved Development
    11 Posts 4 Posters 1.7k Views 4 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.
    • M Offline
      matyldatait
      last edited by

      Hi there.

      Beginner here. I’m finding it a very steep learning curve. I just want a pushbutton (GPIO) to hide/show a module. I thought it would be simple.

      Trawling the forums led me to believe that I can use MMM-Buttons and MMM-Remote-Control. I dont need remote-control through a web interface,but it seemed like the module would still be useful for handling notifications.

      Sorry if this is a bit idiotic - like I said - steep learning curve

      So far I have installed both modules and have this is my config.js:

      {
          module: 'MMM-Remote-Control',
          // uncomment the following line to show the URL of the remote control on the mirror
          position: 'bottom_left',
          // you can hide this module afterwards from the remote control itself
          config: {
              customCommand: {},  // Optional, See "Using Custom Commands" below
              showModuleApiMenu: true, // Optional, Enable the Module Controls menu
              secureEndpoints: true, // Optional, See API/README.md
              // uncomment any of the lines below if you're gonna use it
              //customMenu: "custom_menu.example.json", // Optional, See "Custom Menu Items" below
              // apiKey: "", // Optional, See API/README.md for details
              // classes: {} // Optional, See "Custom Classes" below
          }
      },
      
      {
          module: 'MMM-Buttons', //using GPIO numbers
          config: {
              buttons: [
                         {
                      pin: 25,
                      name: "compliments_visibility",
                      longPress: {
                          notification: "REMOTE_ACTION",
                          payload: {action: "HIDE", module: "compliments"}
                      },
                      shortPress: {
                          notification: "REMOTE_ACTION",
                          payload: {action: "SHOW", module: "compliments"}
                       }
                  },
       
                  {
                      pin: 7,
                      name: "monitor_control",
                      longPress: {
                          notification: "REMOTE_ACTION",
                          payload: {action: "MONITOROFF"}
                      },
                      shortPress: {
                          notification: "REMOTE_ACTION",
                          payload: {action: "MONITORON"}
                      }
                  },
                  {
                      pin: 24,
                      name: "power",
                      longPress: {
                          title: "Power off",
                          message: "Keep pressed for 3 seconds to shut down",
                          imageFA: "power-off",
                          notification: "REMOTE_ACTION",
                          payload: {action: "SHUTDOWN"}
                      },
                      shortPress: undefined
                  }
              ]
          }
      },
      
      
      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @matyldatait
        last edited by

        @matyldatait do the buttons trigger outside using MagicMirror?

        there are python scripts one could use to test

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        M 2 Replies Last reply Reply Quote 0
        • M Offline
          matyldatait @sdetweil
          last edited by

          @sdetweil good idea as a first step debugging. This scrip suggested doing it with button connected between a GPIO pin and ground:

          http://razzpisampler.oreilly.com/ch07.html

          …and yes - that works

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

            @matyldatait and is the vpuo.pin numbering the same between the test tool you used and theagic mirror module? there are two different numbering schemes

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            M 1 Reply Last reply Reply Quote 0
            • M Offline
              matyldatait @sdetweil
              last edited by

              @sdetweil having established that the button is working as connected on pin18,I simplified the button module usage in my config to this:

                  module: 'MMM-Buttons', //use GPIO numbers
                  config: {
                      buttons: [
                                 {
                              pin: 18,
                              name: "test",
                              shortPress: {message: "button pressed"}
                                 },
                              ]
                          },
              

              Still nothing. No message in my terminal or on mirror screen.

              1 Reply Last reply Reply Quote 0
              • M Offline
                matyldatait
                last edited by

                So, figured I could try reinstalling MMM-Buttons. I get this output on attempting to install. Gibberish tome :(

                matylda@raspberrypi:~/MagicMirror $ cd MMM-Buttons/
                matylda@raspberrypi:~/MagicMirror/MMM-Buttons $ npm install
                npm WARN deprecated har-validator@5.1.5: this library is no longer supported
                npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
                npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
                npm WARN deprecated electron-rebuild@1.11.0: Please use @electron/rebuild moving forward. There is no API change, just a package name change

                Magic-Mirror-Module-Buttons@1.0.0 postinstall
                node_modules/.bin/electron-rebuild -e …/…/node_modules/electron

                An unhandled error occurred inside electron-rebuild
                Unable to find electron’s version number, either install it or specify an explicit version

                Error: Unable to find electron’s version number, either install it or specify an explicit version
                at /home/matylda/MagicMirror/MMM-Buttons/node_modules/electron-rebuild/lib/src/cli.js:87:19
                at Generator.next ()
                at fulfilled (/home/matylda/MagicMirror/MMM-Buttons/node_modules/electron-rebuild/lib/src/cli.js:6:58)
                npm ERR! code 255
                npm ERR! path /home/matylda/MagicMirror/MMM-Buttons
                npm ERR! command failed
                npm ERR! command sh -c – node_modules/.bin/electron-rebuild -e …/…/node_modules/electron

                npm ERR! A complete log of this run can be found in:
                npm ERR! /home/matylda/.npm/_logs/2023-02-16T04_32_03_500Z-debug-0.log

                S 1 Reply Last reply Reply Quote 0
                • M Offline
                  matyldatait @sdetweil
                  last edited by

                  @sdetweil yes it is - I also tried both numbering schemes to be sure

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

                    @matyldatait install problem, yes
                    use my fork which contains a fix for that

                    https://github.com/sdetweil/MMM-Buttons

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    M 1 Reply Last reply Reply Quote 0
                    • M Offline
                      matyldatait @sdetweil
                      last edited by

                      @sdetweil thanks very much Sam - I will try that

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        Divis
                        last edited by Divis

                        Did you ever get this one figured out? I am having one hell of an issue trying to get the monitors to turn off. Pin 24 shuts the system down fine. I can change the payload to brightness instead and it works perfectly. But it seems that there’s a disconnect between the MMM-Buttons and the MMM-Remote-Control customCommand section through either running the command alone or in a script. When I run the script or command in terminal through SSH they work fine, but when envoked from MMM it’s ignored or goes no where.

                        			module: 'MMM-Remote-Control',
                        			//https://github.com/Jopyth/MMM-Remote-Control
                        			disabled: false,
                        			//position: 'bottom_left', // Required to show URL/QR code on mirror
                        			// you can hide this module afterwards from the remote control itself
                        			config: {
                        				customCommand: {
                        					//monitorOnCommand: '/home/pi/MagicMirror/config/mm-dispOn.sh',
                        					//monitorOffCommand: '/home/pi/MagicMirror/config/mm-dispOff.sh',
                        				    monitorStatusCommand: 'wlr-randr | grep -q "Enabled: yes" && echo "true" || echo "false"',
                        					monitorOnCommand: 'wlr-randr --output HDMI-A-1 --on',
                        					monitorOffCommand: 'wlr-randr --output HDMI-A-1 --off',
                        				},
                        				secureEndpoints: false, // Optional, See API/README.md
                        				// uncomment any of the lines below if you're gonna use it
                        				// customMenu: "custom_menu.json", // Optional, See "Custom Menu Items" below
                        				// apiKey: "", // Optional, See API/README.md for details
                        				// classes: {}, // Optional, See "Custom Classes" below
                        				showModuleApiMenu: false, // Optional, disable the Module Controls menu
                        				// showNotificationMenu: false, // Optional, disable the Notification menu
                        
                        				// QR Code options (new!)
                        				// showQRCode: true, // Optional, display QR code for easy mobile access (default: true)
                        				// qrCodeSize: 150, // Optional, size of QR code in pixels (default: 150)
                        				// qrCodePosition: "below" // Optional:
                        				//   "below" - Show URL above, QR code below (default)
                        				//   "above" - Show QR code above, URL below
                        				//   "replace" - Show only QR code, no URL text
                        			}
                        		},
                        		{
                        			module: "MMM-Buttons",
                        			//https://github.com/KristjanESPERANTO/MMM-Buttons
                        			disabled: false,
                        			position: "bottom_right",
                        			config: {
                        			buttons: [
                        			  {
                        				pin: 25,
                        				name: "monitor_control",
                        				activeLow: true,
                        				longPress: [
                        				  {
                        					title: "Monitor off",
                        					message: "Keep pressed for 3 seconds to switch the monitor down",
                        					imageFA: "display",
                        					notification: "REMOTE_ACTION",
                        					payload: {action: "monitorOffCommand"},
                        					//payload: { action: "BRIGHTNESS", value: 10 }
                        				  },
                        				],
                        				shortPress: [
                        				  {
                        					title: "Monitor on",
                        					message: "Short press for monitor on",
                        					imageFA: "display",
                        					notification: "REMOTE_ACTION",
                        					payload: {action: "monitorOnCommand"},
                        					//payload: { action: "BRIGHTNESS", value: 100 }
                        				  },
                        				]
                        			  },
                        			  {
                        				pin: 24,
                        				name: "power",
                        				activeLow: true,
                        				longPress: [
                        				  {
                        					title: "Power off",
                        					message: "Keep pressed for 3 seconds to shut down",
                        					imageFA: "power-off",
                        					notification: "REMOTE_ACTION",
                        					payload: {action: "SHUTDOWN"},
                        				  },
                        				]
                        			  }
                        			]
                        			}
                        		},
                        
                        KristjanESPERANTOK 1 Reply Last reply Reply Quote 0
                        • KristjanESPERANTOK Online
                          KristjanESPERANTO Module Developer @Divis
                          last edited by

                          @Divis Looks like an action-name mismatch.

                          MMM-Buttons should send REMOTE_ACTION values such as MONITORON and MONITOROFF.
                          monitorOnCommand and monitorOffCommand are config keys in MMM-Remote-Control, not REMOTE_ACTION values.

                          So in MMM-Buttons, try:

                          • action: MONITORON
                          • action: MONITOROFF
                          1 Reply Last reply Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 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