• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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-Buttons] Not recognizing button presses

Scheduled Pinned Locked Moved Troubleshooting
23 Posts 3 Posters 14.5k 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.
  • I Offline
    istepgueu
    last edited by Feb 5, 2017, 6:16 PM

    For testing in terminal :

    1- Create a button.py file with this :

    import RPi.GPIO as GPIO
    import time
    
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)
    
    tries = 0
    
    while (tries < 200):
        if GPIO.input(25):
            print("Open")
        else:
            print ("Close")
        time.sleep(0.5)
        tries = tries + 1
    
    #GPIO.cleanup()           # clean up GPIO on normal exit
    
    

    2 - Execute with “python button.py”

    3 - Test your button.

    M J 3 Replies Last reply Feb 5, 2017, 6:17 PM Reply Quote 1
    • M Offline
      Mar @istepgueu
      last edited by Feb 5, 2017, 6:17 PM

      @istepgueu thanks, ive done this and its working properly and registers all my clicks.

      1 Reply Last reply Reply Quote 0
      • M Offline
        Mar @istepgueu
        last edited by Feb 5, 2017, 6:34 PM

        @istepgueu im assuming the following would just send out a test broadcast that the pm2 logs can see? It sees the notifications from all the other modules i.e CALENDA_EVENTS etc… when they happen.

        {
                            module: 'MMM-Buttons',
                            config: {
                                buttons: [
                                    {
                                        pin: 5,
                                        name: "TEST",
                                        shortPress: {
                                            notification: "TEST_ACTION",
                                            payload: {action: "ACTIONON"}
                                        },
                                        longPress: undefined
                                    }
                                ]
                            }
                        },
        
        1 Reply Last reply Reply Quote 0
        • J Offline
          Jopyth Moderator @istepgueu
          last edited by Feb 5, 2017, 7:32 PM

          @istepgueu Can I add the snippet and instructions to the readme?

          Helpful sticky: How to troubleshoot

          I 1 Reply Last reply Feb 5, 2017, 7:37 PM Reply Quote 0
          • I Offline
            istepgueu @Jopyth
            last edited by istepgueu Feb 6, 2017, 10:48 AM Feb 5, 2017, 7:37 PM

            @Jopyth Yes of course !

            M 1 Reply Last reply Feb 5, 2017, 7:38 PM Reply Quote 1
            • M Offline
              Mar @istepgueu
              last edited by Feb 5, 2017, 7:38 PM

              @istepgueu So my button registers properly but its not sending out a notification at all. There are no errors and my mirror loads correctly. I’m using the pin5:test code above.

              I 1 Reply Last reply Feb 5, 2017, 7:43 PM Reply Quote 0
              • I Offline
                istepgueu @Mar
                last edited by Feb 5, 2017, 7:43 PM

                @Mar you can you test with this code and capture log from firebug

                {
                                pin: 5,
                                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
                            }
                
                M 1 Reply Last reply Feb 5, 2017, 7:48 PM Reply Quote 0
                • M Offline
                  Mar @istepgueu
                  last edited by Feb 5, 2017, 7:48 PM

                  @istepgueu Alright now this is weird. I have my MM running via HDMI, and also opened it up in a Chrome tab on my laptop. When i press the buttong the inspector shows the log of the button and I get a popup on Chrome. But nothing is happening on the screen connected to the actual pi?

                  I 1 Reply Last reply Feb 5, 2017, 7:49 PM Reply Quote 0
                  • I Offline
                    istepgueu @Mar
                    last edited by Feb 5, 2017, 7:49 PM

                    @Mar I suppose you have try

                    pm2 restart mm
                    
                    M 1 Reply Last reply Feb 5, 2017, 7:53 PM Reply Quote 0
                    • M Offline
                      Mar @istepgueu
                      last edited by Feb 5, 2017, 7:53 PM

                      @istepgueu Tried that, also tried a reboot. Doesnt work on the screen connected to the pi, but still does when i access via a browser. Also when i access via a browser I see this show up in the logs “Initialize button power on PIN 5” but this line doesnt show up when restarting MM and accessing via the HDMI.

                      I 1 Reply Last reply Feb 5, 2017, 8:00 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 2 / 3
                      2 / 3
                      • First post
                        6/23
                        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