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-Page-Selector: A page switcher that can set positions of modules

    Scheduled Pinned Locked Moved System
    94 Posts 14 Posters 94.8k Views 15 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.
    • V Offline
      Veldrovive Module Developer
      last edited by

      @Johans,
      Ah, I believe the confusion comes from the fact that old discussions on this forum do not reflect the current functionality of the module. I try not to make any changes that break old config files, but one was necessary.
      In order to fix this config, you need to replace any instance of pages: "all" with pages: {"all": "some_position"}
      New versions don’t require you to have a position prop at all and you can just use the pages one.
      For more information, refer to the README.
      Hope this helps.

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        Johans @Veldrovive
        last edited by

        @veldrovive said in MMM-Page-Selector: A page switcher that can set positions of modules:

        pages: {“all”: “some_position”}

        Thanks for the info, I should have read the README first. Sorry.

        1 Reply Last reply Reply Quote 0
        • rudibaraniR Offline
          rudibarani Project Sponsor @Veldrovive
          last edited by

          @veldrovive
          Thanks again for implementing the current page as “dynamic” class. If I get it right, you had to code procedures to add and remove the page class when switching pages.

          Ok, the development branch now has support for the new class name changes. When a module is shown on a page, it will be given the class page_{Current Page} and then the class will be removed when the module is hidden.

          Would it be possible to make these procedures accessible via notifications? I am still looking for a way to add and remove classes based on external triggers. A scheme could be like this:

          Notification: "MMM_Page-Selector_Update_Class"
          Payload: {"add":["Module_1_Name:ClassA_to_add", "Module_2_Name:ClassB_to_add"], "remove":["Module_3_Name:ClassC_to_remove", "Module_4_Name:ClassD_to_remove"]}
          
          1 Reply Last reply Reply Quote 0
          • V Offline
            Veldrovive Module Developer
            last edited by

            @rudibarani
            If I am understanding what you are asking for correctly, this function seems to be out of the scope that Page-Selector encompasses. I would develop a module to include this functionality, but I have been inactive in the world of Magic Mirror as of lately. As it stands, I would post this request to the module suggestions forum or ask somebody to include it in a module that has a closer association with this type of purpose. MMM-Remote-Control could be a good candidate.

            rudibaraniR 1 Reply Last reply Reply Quote 0
            • rudibaraniR Offline
              rudibarani Project Sponsor @Veldrovive
              last edited by

              @veldrovive
              OK - thanks for the reply anyway!

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                smarthome @rudibarani
                last edited by smarthome

                Hi all

                To make MMM-page-indicator work with MMM-Page-Selector, we must add MMM-page-indicator in to pages

                {
                			module: "MMM-page-indicator",
                			position: "bottom_bar",
                			"pages": {"Home": "bottom_bar", "News": "bottom_bar","Weather": "bottom_bar","Entertaiment": "bottom_bar","Smarthome": "bottom_bar","System": "bottom_bar"},	
                          	config: {
                			pages: 6,
                			}
                		},
                
                1 Reply Last reply Reply Quote 0
                • S Offline
                  smarthome @Johans
                  last edited by smarthome

                  @Johans

                  pages: "all",
                  

                  You forgot the quotation mark before and after pages

                  "pages": "all",
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • B Offline
                    Brandenborg
                    last edited by

                    I love this module especially in use together with the MMM-navbar.
                    Is there any config using existing code that will let me make it return me to “default” page after a given period of time after changing page?

                    V 1 Reply Last reply Reply Quote 0
                    • V Offline
                      Veldrovive Module Developer @Brandenborg
                      last edited by Veldrovive

                      @Brandenborg
                      This is not a default function of this module. However, if you can edit a small amount of code, it should be easy to implement.
                      Just copy these lines of code right after line 235 of MMM-Page-Selector.js. This lines should be selectPage(payload);

                      clearTimeout(self.default_timeout);
                      if(![0, this.config.defaultPage].includes(payload)){
                          self.default_timeout = setTimeout(() => {
                              selectPage(this.config.defaultPage);
                          }, TIME)
                      }
                      

                      Then just replace TIME with the number of milliseconds you want to remain on the page before it automatically switches back to default. You may also have to change the 0 in the if statement if your default page isn’t at the 0th position.

                      B 1 Reply Last reply Reply Quote 1
                      • B Offline
                        Brandenborg @Veldrovive
                        last edited by

                        @Veldrovive thanks a lot. I should manage that.
                        I recon the 0 position is the first page I define the contents of?

                        V 1 Reply Last reply Reply Quote 0
                        • V Offline
                          Veldrovive Module Developer @Brandenborg
                          last edited by

                          @Brandenborg
                          The 0 should be the position of your default page in the page list. The furthest left is 0.

                          B 1 Reply Last reply Reply Quote 1
                          • B Offline
                            Brandenborg @Veldrovive
                            last edited by

                            @Veldrovive
                            Thanks. And thank you for a really useful module!

                            1 Reply Last reply Reply Quote 1
                            • V Offline
                              Veldrovive Module Developer
                              last edited by

                              @Brandenborg
                              The latest version of this module now has this as a (Not very well tested) feature.
                              You can now specify a restoreDefault prop in the MMM-Page-Selector config with the number of seconds you want before it returns to the default page.

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

                                Hi first of all thanks for this great module, Works great. I wanto to remotely change the pages which works with this commands:

                                http://ip:8080/remote?action=NOTIFICATION&notification=PAGE_DOWN
                                http://ip:8080/remote?action=NOTIFICATION&notification=PAGE_UP

                                But if I want to go to a specific page it does noct work with this command:

                                http://ip:8080/remote?action=NOTIFICATION&notification="SELECT_PAGE"&payload="0"

                                Can somebody tell me whats wrong?

                                V 1 Reply Last reply Reply Quote 0
                                • V Offline
                                  Veldrovive Module Developer @m1scha
                                  last edited by

                                  @m1scha
                                  Hello, glad you’re enjoying the module.

                                  I am assuming that your page has some name that is not "0".

                                  I haven’t extensively tested with magic mirror remote, but I imagine the issue is with setting payload to be a string. When it gets a string, MMM-Page-Selector assumes it is the name of the page, not a page index. If an integer is sent, it assumes it is a page index.

                                  I don’t know how remote works, but you might be able to use
                                  http://ip:8080/remote?action=NOTIFICATION&notification=“SELECT_PAGE”&payload=0

                                  Or you could specify your page name as
                                  http://ip:8080/remote?action=NOTIFICATION&notification=“SELECT_PAGE”&payload=“YOUR_PAGE_NAME”

                                  M 1 Reply Last reply Reply Quote 0
                                  • M Offline
                                    m1scha @Veldrovive
                                    last edited by m1scha

                                    @veldrovive said in MMM-Page-Selector: A page switcher that can set positions of modules:

                                    remote?action=NOTIFICATION&notification=“SELECT_PAGE”&payload=0

                                    Hi, thanks for you reply.
                                    I tested this in several variations, but I get a sucess Message, but change of page.

                                    V 1 Reply Last reply Reply Quote 0
                                    • V Offline
                                      Veldrovive Module Developer @m1scha
                                      last edited by

                                      @m1scha
                                      I checked out MMM-Remote-Control and it is just a problem with string representations.

                                      remote?action=NOTIFICATION&notification=“SELECT_PAGE”&payload=0 sends the literal notification “SELECT_PAGE” including the quotes. A more correct request would be remote?action=NOTIFICATION&notification=SELECT_PAGE&payload=Main which would switch the the page called main.

                                      However, in order to support other modules, pages are 1 indexed by notification so to switch to the first page, you would send remote?action=NOTIFICATION&notification=SELECT_PAGE&payload=1

                                      Strings that are numbers are handled correctly by MMM-Page-Selector.

                                      1 Reply Last reply Reply Quote 1
                                      • I Offline
                                        innovation @Veldrovive
                                        last edited by

                                        @veldrovive Hello! I want to use this module for

                                        1. An intro screen - only for 10 secs
                                        2. Move into screen 2 - stay there

                                        Can I only have one screen to have a time interval and the other doesn’t? If so how?

                                        1 Reply Last reply Reply Quote 0
                                        • R Offline
                                          Riaanh
                                          last edited by

                                          Good day @Veldrovive thanks for the brilliant work you have done on this, and your comments on this is really helpful.

                                          I have an issue to get this going, and been researching and trying for the past two days with no success. I even tried using some of the users on this thread’s config as posted here, and loaded the modules they refer to, but I always end up with a blank page once I load the portion for MMM-Page-Selector.

                                          As soon as I add this portion below, it only display a blank page, or if I comment it out, then the page will display again.

                                          {
                                          			disabled: false,
                                          		        module: "MMM-Page-Selector",
                                          		        position: "top_bar",
                                          		        config: {
                                          			        defaultPage: "Page1",
                                          		                displayTitle: true,
                                          			        selectPageNotif: ["SELECT_PAGE"],
                                          		                incrementPageNotif: ["PAGE_UP"],
                                          		                decrementPageNotif: ["PAGE_DOWN"],
                                             			     }
                                          		},		
                                          

                                          Any advice or even just guidance on where to look further would be greatly appreciated.

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

                                            @Riaanh said in MMM-Page-Selector: A page switcher that can set positions of modules:

                                            MMM-Page-Selector

                                            can u show the messages from where u start MagicMirror

                                            either npm start
                                            or pm2

                                            if using pm2,. then
                                            pm2 logs --lines=100
                                            will show the messages

                                            blank screen is usually a missing library , see
                                            https://forum.magicmirror.builders/topic/15778/fix-for-black-screen-in-2-16-and-later

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            R 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
                                            • 3
                                            • 4
                                            • 5
                                            • 5 / 5
                                            • 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