• 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.

Buttons only work if I access via python first

Scheduled Pinned Locked Moved Unsolved Troubleshooting
8 Posts 3 Posters 731 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 Sep 3, 2023, 9:09 PM

    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 Sep 4, 2023, 6:35 AM Reply Quote 0
    • M Offline
      MMRIZE @gonzonia
      last edited by Sep 4, 2023, 6:35 AM

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

      G 1 Reply Last reply Oct 5, 2023, 2:52 PM Reply Quote 0
      • G Offline
        gonzonia @MMRIZE
        last edited by Oct 5, 2023, 2:52 PM

        @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 Oct 5, 2023, 2:59 PM Reply Quote 0
        • M Offline
          MMRIZE @gonzonia
          last edited by Oct 5, 2023, 2:59 PM

          @gonzonia
          Is your issue solved?

          G 1 Reply Last reply Oct 5, 2023, 3:38 PM Reply Quote 0
          • G Offline
            gonzonia @gonzonia
            last edited by Oct 5, 2023, 3:01 PM

            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 Oct 5, 2023, 3:38 PM

              @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 Oct 5, 2023, 5:09 PM Reply Quote 0
              • M Offline
                MMRIZE @gonzonia
                last edited by Oct 5, 2023, 5:09 PM

                @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 Offline
                  sdetweil @gonzonia
                  last edited by Oct 5, 2023, 5:10 PM

                  @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
                  • 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