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.

    Modules reaction on notifications from other modules

    Scheduled Pinned Locked Moved Solved Troubleshooting
    5 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.
    • M Offline
      MWel1977
      last edited by MWel1977

      Hi all,

      I need yet again some help with modules.
      I would like to add the pages and page indicator modules from Edward Shen to my mirror project but I don’t get the part were these modules should get a notification from the other modules. Well … I do get that for instance the clock module should be adjusted in some way… but I don’t get what file I should alter.
      In his discription it’s stated:

      "
      Regarding notifications

      This module responds to the notification PAGE_CHANGED. The payload should be an integer. Note that this has strict error checking, so “3” will not work, while 3 will. Also do note that to switch to page 1, you need to send 0 to the module. This uses a zero-based numbering system.

      Let’s say that you want to change the indicator to page 3. In your code, you would write:

      this.sendNotification(“PAGE_CHANGED”, 2);
      "

      So I get I must add that last line to a file but I have no idea to what file.
      Can someone help me out?

      Kind regards,
      Mike

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

        @mwel1977
        By default, MMM-Pages can work alone. It can rotate pages automatically by its timer included.
        So, if you want just to activate MMM-Pages itself, you don’t need to consider anything else.
        However, you have some trigger (like a H/W button?) and want to activate MMM-Pages by it, you should build your module and this.sendNotification... will be used inside of that module.
        Or there might be some module which has that feature already, then just use it. In this case, you don’t need to care about this.sendNotifi… at all.

        Conclusion: Are you making your own module? Not the case, don’t care about “this.sendNoti… blah lbah…”. All you have to do is just modifying your config.js.

        M 1 Reply Last reply Reply Quote 1
        • cowboysdudeC Offline
          cowboysdude Module Developer
          last edited by

          You’re asking for blind help here…would be VERY helpful to see the code… ;)

          M 1 Reply Last reply Reply Quote 0
          • M Offline
            MWel1977 @cowboysdude
            last edited by

            @cowboysdude Hi there.

            I know it’s a bit of blind help, but as a newbie I hoped someone here used this module and could help me out.
            But if someone els could help me that’s fine to.:smiling_face_with_halo:

            And posting the code is just the problem.
            This is a module that allow me to put other modules on a different “page” and exclude modules so they show up on all the pages. The link to the github place is this: MMM-pages.

            I need to add the following to the config.je file like we do for all other modules:
            modules: [
            {
            module: ‘MMM-pages’,
            config: {
            modules:
            [[ “weatherforecast”, “newsfeed”],
            [ “calendar”, “compliments” ]],
            excludes: [“clock”, “currentweather”, “MMM-page-indicator”],
            }
            }
            ]

            But in order for this to work (judging from the discribtion) I must add: “this.sendNotification(“PAGE_CHANGED”, 2);”
            to “my code”…
            What code is he talking about???
            Is that the code of all the modules I want to be on a specific page? Is it the code of everymodule listed in the config.js file?

            Can you see my problem (as a newbie to this)? :worried_face: :worried_face:
            I know what I must add and what number to change for it to work…I just don’t know were this piece of code must be added.

            I’m not asking for someone to write me the code so I can just copy and paste it and I’m done…I’ll learn nothing that way (and were is the fun in that??)!
            I’m hoping someone can reply to this and say: “this.sendNotification(“PAGE_CHANGED”, 2); should be added to…” and I can take it up from there. :winking_face:

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

              @mwel1977
              By default, MMM-Pages can work alone. It can rotate pages automatically by its timer included.
              So, if you want just to activate MMM-Pages itself, you don’t need to consider anything else.
              However, you have some trigger (like a H/W button?) and want to activate MMM-Pages by it, you should build your module and this.sendNotification... will be used inside of that module.
              Or there might be some module which has that feature already, then just use it. In this case, you don’t need to care about this.sendNotifi… at all.

              Conclusion: Are you making your own module? Not the case, don’t care about “this.sendNoti… blah lbah…”. All you have to do is just modifying your config.js.

              M 1 Reply Last reply Reply Quote 1
              • M Offline
                MWel1977 @Guest
                last edited by

                Hi @sean,

                Thanks for your explanation! This helps alot!
                And no… :smiling_face_with_open_mouth_smiling_eyes: :smiling_face_with_open_mouth_smiling_eyes: I’n not building my own module… I’m to inexperienced for that. Maybe one day…

                For now I’m just setting up a nice MagicMirror for in my livingroom for me and my family. And I found so many great modules here that they can’t fit all on one page.

                But okay… I must check my config.js were I went wrong because the pages aren’t switching.
                At the issue page of Edward someone issues a problem and put his config.js code there. I’ll check his motition there hoping I can spot the differance. :winking_face:

                Thanks again for your help!

                With kind regards,
                Mike
                (from the Netherlands)

                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