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] Connect multiple buttons to send configurable notifications

    Scheduled Pinned Locked Moved System
    40 Posts 15 Posters 36.9k Views 14 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
      Mar @Jopyth
      last edited by

      @Jopyth Thanks for the response, and that seems to make complete sense. I missed that part in the documentation.

      Though upon trying PINS 22/23 i am still getting the same result. The button.py program detects each individual click properly, but in the MM I have to double (sometimes triple) click the button so that it registers. I can see it registers as it shows up in the pm2 logs and my profile changes.

      Im not sure if its an issue with the buttons as they are a standard 4 pin button and the test script works fine with them?

      J 1 Reply Last reply Reply Quote 1
      • J Offline
        Jopyth Moderator @Mar
        last edited by Jopyth

        @Mar Well its not, as if it were documented anywhere in my readme. :( Should probably add this somewhere.

        How long are you pressing the button? For a very short time? Note, that if the press is longer than 500ms it will not be registered as a (short) press (it is the maxShortPressTime and can be configured).

        If this is not the case, I am sorry, but I have no real idea how to fix it, without having the same situation on my Pi.

        Helpful sticky: How to troubleshoot

        M 3 Replies Last reply Reply Quote 1
        • M Offline
          Mar @Jopyth
          last edited by

          @Jopyth I thought this also, and set the short time from 0-1000ms and still will only register the second of a double click.

          Its very consistent though, i can get it to work 100% of the time with a double click like opening a folder on the computer. one click doesnt do anything, and I don’t believe the longPress worked at all (But i wasnt using it so not that bothered with it).

          Maybe its just the buttons…i just dont have anything else around that i could use to test as a button.

          1 Reply Last reply Reply Quote 0
          • M Offline
            Mar @Jopyth
            last edited by

            @Jopyth Just tested with buttons ripped out from an old monitor and same issue, needed to double click. I suppose i will slowly go through the code and try break it down and see. any advice on which functions to start with?

            1 Reply Last reply Reply Quote 0
            • M Offline
              Mar @Jopyth
              last edited by Mar

              @Jopyth Fixed!! I switched the 1 and the 0 in the watchHandler function of node_helper.js and solved the issue. Must have been backwards with how the button was being interpreted vs set up?

              Put the 0 first, then 1.

              Now the double click makes sense, the time between the clicks seems to have been what was counted as a valid min press time.

              1 Reply Last reply Reply Quote 1
              • M Offline
                Mar
                last edited by

                @Jopyth Anyway to use one button to switch between profiles? Trying to use profile switches classes and creating the same button on different profiles (classes) but it always runs both buttons so take me back to the default page.

                J 1 Reply Last reply Reply Quote 0
                • J Offline
                  Jopyth Moderator @Mar
                  last edited by Jopyth

                  @Mar Glad you got it work. :) Did you switch back to the default (regarding the 0 and 1)? Or is it now different than in the main code? Not yet possible to switch between multiple profiles. Could maybe be implemented as an array of notification definitions, instead of a single notification definition and then it cycles through these notifications on each press?

                  Helpful sticky: How to troubleshoot

                  M 1 Reply Last reply Reply Quote 0
                  • M Offline
                    Mar @Jopyth
                    last edited by Mar

                    @Jopyth No i had to switch the 1 and the 0 to make it work (0 first, then 1) so my code does differ slightly unfortunately. Suppose I’ll have to remember to manually make the change on updates unless it can be made a config option.
                    That could be a good option. We’d need a way for profile switcher to send over all unique profiles which would make it easy to do, rather than scrape the config file for “classes”.

                    edit: Though I suppose thinking about this not relying on another module would be much quicker fix.

                    1 Reply Last reply Reply Quote 0
                    • ? Offline
                      A Former User
                      last edited by yawns

                      What if I want to send an alert show display message when the GPIO port is ON? I mean, is not like a switch that closes the GPIO port, is when you programatically send an outoput GPIO signal to close (lets say a relay). Is there any changes necessary? I can´t make it happen.

                      {
                               module: 'MMM-Buttons',
                              config: {
                              buttons: [
                                      {
                                       pin: 17,
                                      name: "rele",
                                      longPress: {
                                                      title: "Rele longpress",
                                                      message: 'El rele esta siendo pulsado largo',
                                                      imageFA: 'power-off',
                                                      notification: 'SHOW_ALERT',
                                                      payload: {
                                                              type: 'notification',
                                                              title: 'Alerta rele pulsado largo'
                                                      }
                                              },
                                              shortPress:  {
                                                      title: "Rele shortress",
                                                      message: 'El rele esta siendo pulsado corto',
                                                     imageFA: 'power-on',
                                                      notification: 'SHOW_ALERT',
                                               payload: {
                                                            type: 'notification',
                                                              title: 'Alerta rele pulsado largo'
                                                   }
                      
                                              }
                      
                      
                                      }
                              ]
                                      } //del config
                      
                       },
                      
                      1 Reply Last reply Reply Quote 0
                      • PointPubMediaP Offline
                        PointPubMedia
                        last edited by

                        Anyone have an example of a switching profile using Buttons + ProfileSwitcher ?

                        M 1 Reply Last reply Reply Quote 0
                        • M Offline
                          Mar @PointPubMedia
                          last edited by

                          @PointPubMedia

                                          {
                                                  module: 'MMM-ProfileSwitcher',
                                                  config: {
                                                          includeEveryoneToDefault: true,
                                                          ignoreModules: ["alert", "updatenotification"],
                                                          enterMessages: false,
                                                          leaveMessages: false,
                                                          defaultTime: 15000,
                                                          timers: {
                                                                  "PAGE2":{profile:"default"}, //Switch to defaultClass after defaultTime
                                                          }
                                                  }
                                          },
                                          {
                                                  module: 'MMM-Buttons',
                                                  minShortPressTime: 0,
                                                  maxShortPressTime: 1000,
                                                  minLongPressTime: 3000,
                                                  config: {
                                                  buttons: [
                                                          {
                                                                  pin:23,
                                                                  name: "change_profile_1",
                                                                  longPress: undefined,
                                                                  shortPress: {
                                                                          notification: "CURRENT_PROFILE",
                                                                          payload: "PAGE2"
                                                                  }
                                                          },
                                                          {
                                                                  pin: 22,
                                                                  name: "change_profile_2",
                                                                  longPress: undefined,
                                                                  shortPress: {
                                                                          notification: "CURRENT_PROFILE",
                                                                          payload: "default"
                                                                  }
                                                          }
                                                  ]
                                                  }
                                          },
                          
                          1 Reply Last reply Reply Quote 2
                          • B Offline
                            B4rth
                            last edited by

                            can this module be used to send notification to the newsfeed module?
                            I can’t get it to work, not throuht sending it directly nether over the remote-module.
                            Have anyone have done it and can help me?

                            J 1 Reply Last reply Reply Quote 0
                            • J Offline
                              Jopyth Moderator @B4rth
                              last edited by

                              @B4rth Please note that a notification never has a dedicated receiver. It is always a broadcast to all other modules. But sending notifications should definitely work with the module. Is your button working? If you are struggling with the correct URL for sending notifications, you can use this fiddle to build the correct URL.

                              The below config should be a simple example for showing an alert (it sends a notification to all modules and the alert module reacts to it):

                              {
                                  module: 'MMM-Buttons',
                                  config: {
                                      buttons: [
                                          {
                                              pin: 25,
                                              name: "test_button",
                                              longPress: {
                                                  notification: "SHOW_ALERT",
                                                  payload: {"title": "Hello World", "message": "Long Press!"}
                                              },
                                              shortPress: {
                                                  notification: "SHOW_ALERT",
                                                  payload: {"title": "Hello World", "message": "Short Press!"}
                                              }
                                          }
                                      ]
                                  }
                              },
                              

                              Make sure to check that you are using the correct pin number and change the notification config, if you want another module to react.

                              Helpful sticky: How to troubleshoot

                              1 Reply Last reply Reply Quote 1
                              • PointPubMediaP Offline
                                PointPubMedia
                                last edited by

                                Hey guys…

                                Is it me or having this module + ProfileSwitcher + Facial are not working well together.

                                I have no issue using the buttons + ProfileSwitcher as I can toggle between profile! Facial recognize me but switch to nothing…

                                J 1 Reply Last reply Reply Quote 0
                                • J Offline
                                  Jopyth Moderator @PointPubMedia
                                  last edited by

                                  @PointPubMedia Did you check out this section? There are some changes needed to make both work together smoothly.

                                  Helpful sticky: How to troubleshoot

                                  1 Reply Last reply Reply Quote 1
                                  • R Offline
                                    RickyTerzis
                                    last edited by

                                    Hi…i am a new user here. In my case sing a python test program i can see every single instance of my button press is registered instantly. But in the mirror it seems MMM-Buttons doesnt register pushes unless sometimes I double or triple click.

                                    J 1 Reply Last reply Reply Quote 0
                                    • J Offline
                                      Jopyth Moderator @RickyTerzis
                                      last edited by

                                      @RickyTerzis I released changes from the development branch, can you try experimenting with the new activeLow setting? Maybe you used the inverse wiring to the one I anticipated?

                                      Helpful sticky: How to troubleshoot

                                      1 Reply Last reply Reply Quote 0
                                      • P Offline
                                        pedroken
                                        last edited by

                                        Hi, @Jopyth, great job on all modules that you developed. They’re great!
                                        I`m trying to send a hide module action to the MMM-Remote-Control module in order to hide the clock (I already know that the id is module_2_clock).

                                        I can’t get it to work with MMM-Buttons. The button is working (worked with an alert), but I think that I doing the wrong thing on the parameters of the HIDE module action.

                                                   {
                                                    pin: 5,
                                                    name: "HideClock",
                                                    shortPress: {
                                                       title: "Hide clock Test",
                                                        notification: "REMOTE_ACTION",
                                                        payload: {"action": "HIDE", "identifier": "module_2_clock"}
                                                    },
                                                    longPress: undefined
                                                }
                                        

                                        Can you or someone give me a clue?
                                        I’d be greateful, thanks!

                                        J 1 Reply Last reply Reply Quote 0
                                        • J Offline
                                          Jopyth Moderator @pedroken
                                          last edited by

                                          @pedroken I think you almost got it, just use module instead of identifier:
                                          payload: {"action": "HIDE", "module": "module_2_clock"}

                                          Helpful sticky: How to troubleshoot

                                          P 1 Reply Last reply Reply Quote 3
                                          • P Offline
                                            pedroken @Jopyth
                                            last edited by

                                            This post is deleted!
                                            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
                                            • 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