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

Interaction between MMM-Pages & MMM-GroveGestures

Scheduled Pinned Locked Moved Solved Requests
12 Posts 2 Posters 3.9k 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.
  • B Offline
    bolish
    last edited by Feb 2, 2019, 5:05 PM

    Hi,

    I was thinking about MMM-GroveGestures to be able to send different notifications based on the MMM-Pages active page. I.e :

    When on Page 1, "CLOCKWISE " triggers “ARTICLE_NEXT”
    but
    When on Page 2, “CLOCKWISE” triggers something else…

    Do you think it’s easily doable ? Anyone interested to implement that into MMM-GroveGestures?

    Regards

    ? 1 Reply Last reply Feb 2, 2019, 10:29 PM Reply Quote 0
    • ? Offline
      A Former User @bolish
      last edited by Feb 2, 2019, 10:29 PM

      @bolish
      Interesting. Unfortunately it couldn’t at this moment.

      1 Reply Last reply Reply Quote 0
      • B Offline
        bolish
        last edited by Feb 2, 2019, 11:09 PM

        @Sean
        Because technical limitations?
        I believe because it’s not possible to know which MMM-Pages is currently “active”?
        What would we need to make this possible in future?

        ? 1 Reply Last reply Feb 3, 2019, 8:19 AM Reply Quote 0
        • ? Offline
          A Former User @bolish
          last edited by Feb 3, 2019, 8:19 AM

          @bolish
          You are right. It doesn’t detect “current” page.
          Maybe I can consider “commands set” to be changed dynamically on runtime by notification.

          1 Reply Last reply Reply Quote 0
          • B Offline
            bolish
            last edited by Feb 3, 2019, 11:05 AM

            @Sean

            I believe that MMM-Pages is already sending some notification “PAGE CHANGED, X”. X being the number of the active page.

            !! It even seems that MMM-pages is even able to respond to PAGE QUERY notification by sending the Page N° back into a notification!!! , look at what I found into MMM-pages :

            case 'QUERY_PAGE_NUMBER':
                    this.sendNotification('PAGE_NUMBER_IS', this.curPage);
                    break;
                  default: // Do nothing
            

            So…if “MMM-GroveGestures” would be able to query MMM-Pages after received gesture notification and before running related action, would be perfect I guess!!

            Please forgive me if I’m totally wrong, it’ based on my “non-skilled logic”, but seems logic in my mind at least!!

            ? 1 Reply Last reply Feb 3, 2019, 12:50 PM Reply Quote 0
            • ? Offline
              A Former User @bolish
              last edited by Feb 3, 2019, 12:50 PM

              @bolish
              Good suggestion. The only thing I aware is I don’t want to make a module dependent with specific module directly in its code.
              So I’m considering commands set which could be selected by notification(even from MMM-Pages) on runtime if it needs. I think it could be used for your case.

              1 Reply Last reply Reply Quote 0
              • B Offline
                bolish
                last edited by Feb 3, 2019, 1:09 PM

                @Sean agree to avoid dependencies.
                Commands set & runtime is far over my skills level (for now at least, maybe I will dig in javascript in future).
                Anyway, anything you need from me, such as testing, let me know!

                Appreciate your support if you could give some of your time to this idea.

                ? 1 Reply Last reply Feb 4, 2019, 4:20 PM Reply Quote 0
                • ? Offline
                  A Former User @bolish
                  last edited by Feb 4, 2019, 4:20 PM

                  @bolish I’ve updated.

                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    bolish
                    last edited by bolish Feb 4, 2019, 10:14 PM Feb 4, 2019, 10:11 PM

                    @Sean you’re fast.
                    I’ve made several trials, everything seems to work perfectly with your new code. You rock.

                    Nevertheless, I’m facing an issue…I believe it’s because I’m not able to write the payload thing right…Would you mind having a look :

                    commandSetTrigger: {
                    					  "TESTESTT": "0",
                    					  "DEFAULT_MODE": "DEFAULT_MODE",
                      					  "PAGE_NUMBER_IS": (payload) => { // You can use callback function to change set with conditional payload values.
                    									    return payload.commandSetName
                    											  }
                    					},
                    

                    At one moment in time, I’m receiving “PAGE_NUMBER_IS” with payload=X.
                    I’ve a commandset called “X”, but it’s not working…

                    I’ve tried to send “PAGE_NUMBER_IS” + payload “X” manually = your code works fine. So no issue there.
                    I’ve installed a notification reader = i’m sure I’m receiving the “PAGE_NUMBER_IS” notification. So that’s fine also.

                    The only thing I maybe don’t know is what payload “X” (0 or 1 or 2 or 3) is included in the notification I’m receiving. I tried to transform this notification+payload into an alert+payload (through MMM-notification trigger) to check what the “X” payload is…But I also failed to do that because you need to deal with payload/return which I don’t know…
                    Nevertheless, I’m quiet convinced X=0 because it’s how the MMM-PAGES works.

                    Anyway, I’m stucked and I believe it’s because I’m writting the payload thing wrong.

                    Would appreciate your support there.

                    ? 1 Reply Last reply Feb 5, 2019, 7:35 AM Reply Quote 0
                    • ? Offline
                      A Former User @bolish
                      last edited by Feb 5, 2019, 7:35 AM

                      @bolish
                      Try this.

                      "PAGE_NUMBER_IS": (payload) => { return payload }
                      
                      1 Reply Last reply Reply Quote 0
                      • 1
                      • 2
                      • 1 / 2
                      1 / 2
                      • First post
                        9/12
                        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