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.

    Buttons only work if I access via python first

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    8 Posts 3 Posters 1.4k Views 3 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.
    • G Offline
      gonzonia
      last edited by

      I’ve had this problem for a while and I’m not sure how to fix it.
      I’m using MMM-Buttons to switch between scenes from MMM-Scenes and it’s working. However, it only works if I first use a little python test program I have to test the buttons. Why? I don’t even have to actually press a button, just run the python and then exit. After that, the buttons work.

      I thought I posted this before but can’t find it. I apologize if this is a duplicate.

      Python:

      import RPi.GPIO as GPIO
      import time
      
      GPIO.setmode(GPIO.BCM)
      
      GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)
      GPIO.setup(24, GPIO.IN, pull_up_down=GPIO.PUD_UP)
      
      
      while True:
          input_state25 = GPIO.input(25)
          input_state24 = GPIO.input(24)
          if input_state25 == False:
              print('Button Pressed 25')
              time.sleep(0.2)
          if input_state24 == False:
              print('Button Pressed 24')
              time.sleep(0.2)
      
      M 1 Reply Last reply Reply Quote 0
      • M Offline
        MMRIZE @gonzonia
        last edited by

        @gonzonia
        A few modules have similar names; which one are you using exactly?

        G 1 Reply Last reply Reply Quote 0
        • G Offline
          gonzonia @MMRIZE
          last edited by

          @MMRIZE Sorry for the delay I missed your response.

          I’m using https://github.com/Jopyth/MMM-Buttons but happy to switch if there’s something better.

          I’m using it to switch scenes in MMM-Scenes by sending “SCENES_NEXT” or “SCENES_PREV”

          M G 2 Replies Last reply Reply Quote 0
          • M Offline
            MMRIZE @gonzonia
            last edited by

            @gonzonia
            Is your issue solved?

            G 1 Reply Last reply Reply Quote 0
            • G Offline
              gonzonia @gonzonia
              last edited by

              Oh, I’m realized I’m not actually using https://github.com/sdetweil/MMM-Buttons to fix the install issues

              1 Reply Last reply Reply Quote 0
              • G Offline
                gonzonia @MMRIZE
                last edited by

                @MMRIZE No. I still need to run my little test script to get the buttons to work. It’s not a huge deal, I just wonder why that’s the case.

                M S 2 Replies Last reply Reply Quote 0
                • M Offline
                  MMRIZE @gonzonia
                  last edited by

                  @gonzonia
                  Sorry, I read the module but found nothing suspicious in that. The module and its dependencies look normal. ATM, I cannot guess the issue.

                  1 Reply Last reply Reply Quote 0
                  • S Do not disturb
                    sdetweil @gonzonia
                    last edited by

                    @gonzonia see this maybe

                    https://roboticsbackend.com/raspberry-pi-gpios-default-state/

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    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