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.

    Push button (MMM-Buttons) does not send out notification to MMM-StopwatchTimer

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    11 Posts 2 Posters 1.2k 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.
    • C Offline
      changaud
      last edited by

      Hello all,

      I am working with the MMM-Buttons module to connect a push button to GPIO pin 25 (physical pin: 22) and have it start the stopwatch by notification. I tested my button using my terminal and found that it was connected fine, but when I set the configurations it does not do anything :(. Any help is much appreciated!

      Below is all I have modified.

      By the way, after major googling I found that the module uploaded by SmartMirror was buggy so I replaced it with this repository: https://github.com/sdetweil/MMM-Buttons.

      config.js file:

      },
      		{
      			module: "MMM-StopwatchTimer",
      			config: {
      				animation: true,
      				sound: true,
      				soundFile: 'buzz.wav',
      				useNativeSound: true,
      				useAlertStyle: true,
      				//notification: ["START_STOPWATCH", "PAUSE_STOPWATCHTIMER"]			
      			}
      				
      		},
      		{
      		    	module: 'MMM-Buttons',
      			position: "middle_center",
      		    	config: {
      				buttons: [
      			    	{
      					pin: 25,
      					name: "test_button",
      					longPress: {
      					notification: "PAUSE_STOPWATCHTIMER",
      				    	payload: {action: "PAUSE_STOPWATCHTIMER"}
      				},
      					shortPress: {
      				    	notification: "START_STOPWATCH",
      				    	payload: {action: "START_STOPWATCH"}
      					}
      			    	}
      			    	
      				]
      		    	}
      		}
      

      buttons.js file:

      Module.register("MMM-Buttons", {
      
          requiresVersion: "2.1.0",
      
          // Default module config.
          defaults: {
              buttons: [
      			    	{
      					pin: 25,
      					name: "test_button",
      					longPress: {
      					notification: "PAUSE_STOPWATCHTIMER",
      				    	payload: {action: "PAUSE_STOPWATCHTIMER"}
      				},
      					shortPress: {
      				    	notification: "START_STOPWATCH",
      				    	payload: {action: "START_STOPWATCH"}
      					}
      			    	}
      			    	
      				],
              minShortPressTime: 0,
              maxShortPressTime: 500,
              minLongPressTime: 3000,
              bounceTimeout: 300
          },```
      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @changaud
        last edited by

        @changaud 1st, never edit a modules source file. all config goes in config.js

        did you use the right pin number
        ?1000025553.jpg

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        C 1 Reply Last reply Reply Quote 0
        • C Offline
          changaud @sdetweil
          last edited by

          @sdetweil Thank you for your response! I will keep that in mind, but do I just leave the button configuration in the buttons module blank then? Also, I have it connected to the physical button 22 which translates to GPIO 25 so I wrote 25 down in the configuration file.

          S 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @changaud
            last edited by

            @changaud said in Push button (MMM-Buttons) does not send out notification to MMM-StopwatchTimer:

            but do I just leave the button configuration in the buttons module blank then

            you already put it in the config.js file

            {
            		    	module: 'MMM-Buttons',
            			position: "middle_center",
            		    	config: {
            				buttons: [
            			    	{
            					pin: 25,
            					name: "test_button",
            					longPress: {
            					notification: "PAUSE_STOPWATCHTIMER",
            				    	payload: {action: "PAUSE_STOPWATCHTIMER"}
            				},
            					shortPress: {
            				    	notification: "START_STOPWATCH",
            				    	payload: {action: "START_STOPWATCH"}
            					}
            			    	}
            			    	
            				]
            		    	}
            		}
            

            config overrides whatever is defined in the source file defaults section

            Sam

            How to add modules

            learning how to use browser developers window for css changes

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

              @changaud said in Push button (MMM-Buttons) does not send out notification to MMM-StopwatchTimer:

              Also, I have it connected to the physical button 22 which translates to GPIO 25 so I wrote 25 down in the configuration file

              it was just a question… many starting users don’t know about the different numbering

              so, when u push the button, outside magic mirror it works…

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              C 1 Reply Last reply Reply Quote 0
              • C Offline
                changaud @sdetweil
                last edited by

                @sdetweil Yes so weird and frustrating T^T… Here is a picture of my setup. In addition, sometimes I get the error (this image is also in the google drive) and sometimes I don’t. I think it goes away after I delete and reclone the buttons repository. https://drive.google.com/drive/folders/1y_QLDCuhfv9XELST0u2hwxTB4f3Fp4h9?usp=drive_link

                S 2 Replies Last reply Reply Quote 0
                • S Offline
                  sdetweil @changaud
                  last edited by

                  @changaud said in Push button (MMM-Buttons) does not send out notification to MMM-StopwatchTimer:

                  @sdetweil Yes so weird and frustrating T^T… Here is a picture of my setup. In addition, sometimes I get the error (this image is also in the google drive) and sometimes I don’t. I think it goes away after I delete and reclone the buttons repository. https://drive.google.com/drive/folders/1y_QLDCuhfv9XELST0u2hwxTB4f3Fp4h9?usp=drive_link

                  is this a pi5?

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  C 1 Reply Last reply Reply Quote 0
                  • C Offline
                    changaud @sdetweil
                    last edited by

                    @sdetweil This is a pi4 model b.

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

                      @changaud if you run your test script before launching mm does it work?

                      see this
                      https://github.com/Jopyth/MMM-Buttons/issues/20

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      C 1 Reply Last reply Reply Quote 0
                      • C Offline
                        changaud @sdetweil
                        last edited by

                        @sdetweil No it does not :( Do the errors possibly have something to do with it? I noticed the errors start to happen after the button is initialized. Also, do I have to have version 2.1.0 or is my current version (most updated) fine?

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