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.
    • rudibaraniR Offline
      rudibarani Project Sponsor @Veldrovive
      last edited by

      @veldrovive Thank you very much!

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

        Dear @Veldrovive,

        sorry for not getting back to you anytime sooner. I am still struggling to get my mirror to work again. I updated MMM-Page-Selector from a version prior the changes with the second config-layout to your development branch to try out persistent pages.

        Since then, my mirror is very slow and unusable. If I try the new layout, my mirror stays black. If I try the old layout for the config file, it sometimes shows an image after a long period of time - but so slow, you can see how the site is being built up.

        I will need some time, hopefully this weekend, to reduce my current config to just MMM-Page-Selector and add one module after the other to see if the problem originates from MMM-Page-Selector or the combination with another module.

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

          Dear @Veldrovive,

          I have reduced my config file to very few modules but my MagicMirror keeps restarting every few seconds. That does not happen, if I stick with the “old” style of configuring Pages within MagicMirror. It seems, I make a general mistake with the way, the second Page setup should be done.

          Would you mind having a look, why this slimmed down version does not work?

          /* Magic Mirror Config Sample
           *
           * By Michael Teeuw http://michaelteeuw.nl
           * MIT Licensed.
           *
           * For more information how you can configurate this file
           * See https://github.com/MichMich/MagicMirror#configuration
           *
           */
          
          var config = {
            address: '0.0.0.0', // Address to listen on, can be:
            // - 'localhost', '127.0.0.1', '::1' to listen on loopback interface
            // - another specific IPv4/6 to listen on a specific interface
            // - '', '0.0.0.0', '::' to listen on any interface
            // Default, when address config is left out, is 'localhost'
            port: 8080,
            ipWhitelist: [
              '127.0.0.1',
              '::ffff:127.0.0.1',
              '::1',
              ['192.0.0.60', '192.0.0.189']
            ], // Set [] to allow all IP addresses
            // or add a specific IPv4 of 192.168.1.5 :
            // ['127.0.0.1', '::ffff:127.0.0.1', '::1', '::ffff:192.168.1.5'],
            // or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
            // ['127.0.0.1', '::ffff:127.0.0.1', '::1', '::ffff:192.168.3.0/28'],
          
            language: 'de',
            timeFormat: 24,
            units: 'metric',
            customCss: 'css/custom.css',
          
            modules: [
              {
                module: 'MMM-Page-Selector',
                position: 'top_bar',
                config: {
                  defaultPage: 'tag', // Tag
                  displayTitle: true, // disable in production mode
                  persistentPages: true,
                  selectPageNotif: ['SELECT_PAGE'],
                  incrementPageNotif: ['PAGE_UP'],
                  decrementPageNotif: ['PAGE_DOWN']
                }
              },
              {
                module: 'alert',
                disabled: false,
                config: {}
              },
              {
                module: 'MMM-WatchDog',
                disabled: false,
                config: {
                  // See 'Configuration options' for more information.
                }
              },
              {
                module: 'MMM-Remote-Control',
                disabled: false
              },
              {
                module: 'MMM-Remote-Control-Repository',
                disabled: false
              },
              {
                module: 'updatenotification',
                disabled: false
              },
              {
                module: 'MMM-Snow',
                disabled: true, // final: set to false, hide in Remote Control & Save
                config: {
                  // See 'Configuration options' for more information.
                  flakeCount: 111,
                  theme: 'winter' // Possible values are winter, love, and water
                }
              },
              {
                module: 'MMM-Love',
                disabled: true, // final: set to false, hide in Remote Control & Save
                config: {
                  // See 'Configuration options' for more information.
                  flakeCount: 111,
                  theme: 'love' // Possible values are winter, love, and water
                }
              },
              {
                module: 'MMM-ip',
                disabled: false,
                config: {}
              },
              {
                module: 'clock',
                disabled: false,
                config: {
                  clockBold: false,
                  displaySeconds: false,
                  dateFormat: 'dddd, ll'
                }
              },
              {
                module: 'MMM-TextClock',
                disabled: false,
                config: {
                  layout: 'Field', // options are 'Line' and 'Field'
                  its24: 'ES IST', // text before hour
                  to24: ' ', // text between hour and minute
                  after24: 'UHR', // text after minute
                  marked: 'color: white; font-weight: 400;', // css code to mark current time in Field layout
                  offset: 2 // standard: 2
                }
              },
              {
                module: 'newsfeed',
                disabled: false,
                config: {
                  // The config property is optional.
                  // If no config is set, an example calendar is shown.
                  // See 'Configuration options' for more information.
                  feeds: [
                    {
                      title: 'Tagesschau',
                      url: 'http://www.tagesschau.de/xml/rss2'
                    }
                  ]
                }
              }
            ], // top_bar, top_left, top_center, top_right, upper_third, middle_center, lower_third, bottom_left, bottom_center, bottom_right, bottom_bar, fullscreen_above, and fullscreen_below
            pages: {
              tag: {
                'clock': 'bottom_left',
                'newsfeed': 'bottom_bar'
              },
              abend: {
                'clock': 'bottom_left',
                'newsfeed': 'bottom_bar'
              },
              nacht: {
                'MMM-TextClock': 'bottom_center' // Bottom Center nur für MMM-TextClock verwenden. CSS verändert!!!
              },
              wochenende: {
                'clock': 'bottom_left',
                'newsfeed': 'bottom_bar'
              },
              annika: {
                'clock': 'bottom_left',
                'newsfeed': 'bottom_bar'
              },
              phillip: {
                'updatenotification': 'top_bar',
                'clock': 'bottom_left',
                'newsfeed': 'bottom_bar'
              },
              kinder: {
                'clock': 'bottom_left',
                'newsfeed': 'bottom_left'
              },
              system: {
                'updatenotification': 'bottom_bar',
                'MMM-ip': 'bottom_right',
                'MMM-Remote-Control': 'bottom_right' // uncomment the following line to show the URL of the remote control on the mirror
              },
              test: {
                'updatenotification': 'bottom_bar'
              }
            },
            exclusions: {
            }
          };
          
          /** ************* DO NOT EDIT THE LINE BELOW ***************/
          if (typeof module !== 'undefined') {
            module.exports = config;
          }
          
          1 Reply Last reply Reply Quote 0
          • R Offline
            robiv8
            last edited by robiv8

            I guess it’s the MM-WatchDog module
            Check that out

            MMM-WatchDog module keeps an eye on your UI and quits app in case the UI crashes. If you combine this with the PM2 process manager, MM2 will automaticly restart after a UI failure.

            So you said: “my MagicMirror keeps restarting every few seconds.”

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

              Yep, I can verify that it is in fact WatchDog.
              I can also provide an explanation and a patch that you can do yourself. The way I made it possible to not include the position prop anymore is by building a temporary config, loading that one, restarting magic mirror, and then replacing the temporary with the original. I’m really sure of the underlying reason, but this process seems to trigger WatchDog to trigger an abort.
              As robiv says, combined with pm2, this causes a restart loop.
              The two easiest ways to get around this are:

              1. Don’t use watchdog. If you don’t think that you are going to experience crashes, then that works
              2. Give a position prop to every module. Including position props doesn’t change any of the visual function and that way, Page-Selector never triggers a restart and the problem doesn’t occur in the first place. The config for any given module should follow this format:
              {
                  module: 'MMM-module-name',
                  position: 'any_position' //It doesn't matter what it is
                  disabled: false,
                  config: {
                      ...
                  }
              },
              

              I will try to find a way to make the modules play well together, but that might take a while.

              rudibaraniR 2 Replies Last reply Reply Quote 0
              • R Offline
                robiv8
                last edited by

                Hallo Veldrovive,
                I just asked you a question on GitHub about Button.
                Should I write this here or on GitHub? Where do you prefer it?

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

                  Hey robiv,
                  I do actually prefer to have issues opened on GitHub. That way I can more easily keep track of them and also it provides a record of my work in case I want to use it in order to prove my merit.
                  Thanks for asking.

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

                    OK Thanks.
                    It’s not really an issue, its a question about Button with Selector Howto ;-)

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

                      @veldrovive @robiv8 Thank you two for the quick feedback and nailing it down so quickly.
                      I will disable Watchdog for the time being. I was using it as I experienced crashes when using an iFrame module for video playback (ISS livestream on my night-page). But it should be OK to live without that for a while.

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

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

                        Ok, I’ve implemented persistent pages. In order to access them right now, you need to be in the development branch since I don’t have the time to do extensive testing.

                        Thanks again for the persistent pages feature. I have tried it all day in different scenarios and it was working reliably and as expected. :clapping_hands:

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

                          @veldrovive PS: I tried following your workaround and just wanted to let you know that it works :) Now I am able to use your new config option for pages which makes it so much easier to set them up! Great idea to implement it!

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

                            @rudibarani
                            Good stuff. I’m glad everything is working out.

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

                              @veldrovive I got the second page layout working with MMM-Watchdog: added a position-value to each module as you suggested and changed the settings to a heartbeat of 5 sec and a restart interval, in case the feedback is not sufficient, of 31 sec. Maybe the default values where just to tight and interfered with your tricks to layout the pages.

                              How does MMM-Page-Selector decide about the order in which modules within the same location are stacked on top of each other? I have would like to move an instance of MMM-DWD-WarnWeather below MMM-MyWeather but changing the order in the “pages” part of the layout does not have an effect on the order on the screen.

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

                                @rudibarani Good to know that’s a solution.
                                Right now, modules are stacked in the order that they appear in the config file. If a module is above another in the config, it will be above that other one on the page.
                                However, with a little work, that could be changed. Do you think that it would be helpful to be able to change that on a page to page basis?

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

                                  @Veldrovive The order seems to be exactly the other way round - if module A is below module B in the config file, it will be above module B on the mirror.

                                  I guess it would be quite intuitive if the second layout option would sort the modules on the screen in the way they are ordered in each page definition. This would also support the concept, that the module definition contains the configurations and the pages part contains all the layout.

                                  Personally, I would also benefit from this option as I use CSS styles to e.g. show only the weather warning symbols on one page and only the text version on another page. Both would be in different positions, if it were possible.

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

                                    Oh, that’s odd that it is going in inverse order. I must have made a mistake somewhere. I’ll be looking into that and reversing it.

                                    I have finals coming up soon which means I don’t have very much time to support this and a more intuitive way of ordering the elements will take a bit of time.

                                    Can you clarify what you mean with your last statement? If I am interpreting it correctly, you are saying that you would like a way of specifying CSS for specific pages. If I’m not mistaken, this would be a pretty quick and easy change as I would just update the class list to include the current page name.

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

                                      Thanks - including the current page into the class list would be helpful.

                                      From the usability point of view, having all layout-options in the “pages” section would be clean and intuitive. Going in from the outside, one gets easily that the modules part contains all config elements and the pages part does the layout of the pages.

                                      Having the order of the config-elements in the “modules” section play the central part in sorting everything seems a little odd. It is OK - once you know it - but also involves moving around the modules and risking bracket- and comma-errors every time you want to try a new layout.

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

                                        Dear @Veldrovive,
                                        I am trying to use an old MacMini to host a mirror, as I would like play BluRays and Amazon Prime Videos on my mirror as well. Everything works fine - except for the option to save the current page.
                                        Frist, I thought this might be a permission issue - but even setting the MagicMirror folder and all its contents recursively to “chmod 777” did not solve it. The mirror always goes back to the standard page and not the current page. Setting “persistentPages” to true does not have any effect.
                                        As you know how you store and restore the “current page” - do you have any idea how to get this going again?
                                        Thanks a lot for your help!

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

                                          Hey @rudibarani,
                                          If there are no errors being thrown, then I would make sure that you are on the development branch and not master as I am still not sure how stable some changes are so I am refraining from merging.
                                          If that is not the problem, I would open up thenode_helper.js file and put console.log() statements in some places to make sure they are running correctly.

                                          1. Line 30 should be self.restorePage(). I would put on right before that. If it never runs, then there is a problem with how the frontend is handling the config.
                                          2. Line 38 should then be jsonObj = JSON.parse(obj);. I would print out the value of jsonObj right after that runs to see if the page key is in it.
                                          3. Line 57 should then be reject(err);. I see that I accidentally didn’t include any debug information when this rejects so put a log that prints out the error directly before this.

                                          If the problem isn’t immediately obvious, posting the output of those logs would go a long way to figuring this out.

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

                                            Dear @Veldrovive,
                                            oh - I have to run and hide somewhere. I did forget to clone the development branch when setting up the Mac Mini. Sorry for bothering you with this :unamused_face:

                                            As always, if you do things right, they work :smiling_face_with_smiling_eyes:

                                            You said you it would be a quick change to update the class list to contain the current page. If you have time to add this, it would help me a lot!

                                            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
                                            • 3 / 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