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

MMM-pages - how to know which page index my module has?

Scheduled Pinned Locked Moved Development
29 Posts 4 Posters 2.6k Views 4 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.
  • S Away
    sdetweil @evroom
    last edited by sdetweil Jan 18, 2025, 3:40 PM Jan 18, 2025, 3:40 PM

    @evroom sorry, don’t quite understand

    your module would support the suspend/resume functions and be called at each appropriately

    MMM-pages calls hide and show

    Screenshot at 2025-01-18 09-39-22.png

    there is also a ‘different’ way to configure pages

    use an arbitrary name for each page

    and then add that to the classes of the modules you want on that page
    see https://github.com/sdetweil/MMM-pages?tab=readme-ov-file#class-based-configuration
    Screenshot at 2025-01-18 09-36-17.png

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    S 1 Reply Last reply Jan 18, 2025, 3:48 PM Reply Quote 0
    • S Away
      sdetweil @sdetweil
      last edited by Jan 18, 2025, 3:48 PM

      @evroom

      from my SampleModule.js

      	// system notification your module is being hidden
      	// typically you would stop doing UI updates (getDom/updateDom) if the module is hidden
      	suspend: function(){
      
      	},
      
      	// system notification your module is being unhidden/shown
      	// typically you would resume doing UI updates (getDom/updateDom) if the module is shown
      	resume: function(){
      
      	},
      

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      S E 2 Replies Last reply Jan 18, 2025, 3:51 PM Reply Quote 0
      • S Away
        sdetweil @sdetweil
        last edited by Jan 18, 2025, 3:51 PM

        @evroom my MMM-SleepWake uses an external trigger to cause modules to be shown/hidden (screen saver where the screen won’t turn off)

        I provide a commandline command to interact with the module…
        i use a webcam with the motion project daemon to trigger show/hide

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • E Offline
          evroom @sdetweil
          last edited by Jan 18, 2025, 3:54 PM

          @sdetweil
          Yeah, this module is kind of in my foster care.
          I did not come up with the code; only made some tweaks and made it available.
          There is not suspend or resume to been seen in the code.

          But I will study the stuff you mentioned and will try to implement that.

          Thx.

          MagicMirror version: 2.30.0
          Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
          Raspbian GNU/Linux 12 (bookworm)

          Test environment:
          MagicMirror version: v2.30.0
          Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
          Raspbian GNU/Linux 12 (bookworm)

          E 1 Reply Last reply Jan 18, 2025, 3:57 PM Reply Quote 0
          • E Offline
            evroom @evroom
            last edited by Jan 18, 2025, 3:57 PM

            As a workaround, I will make it a requirement to put the MMM-Player on the first page (page index 0).
            When I receive 0, then I will start streaming, otherwise I will stop streaming.
            That seems to work.

            MagicMirror version: 2.30.0
            Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            Test environment:
            MagicMirror version: v2.30.0
            Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            E M 3 Replies Last reply Jan 18, 2025, 4:00 PM Reply Quote 0
            • E Offline
              evroom @evroom
              last edited by Jan 18, 2025, 4:00 PM

              @sdetweil
              Short question:

              There are 2 versions of MMM-pages:

              https://github.com/edward-shen/MMM-pages
              https://github.com/sdetweil/MMM-pages

              They seem in-sync, but which one would be the preferred one to take?

              MagicMirror version: 2.30.0
              Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
              Raspbian GNU/Linux 12 (bookworm)

              Test environment:
              MagicMirror version: v2.30.0
              Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
              Raspbian GNU/Linux 12 (bookworm)

              S 1 Reply Last reply Jan 18, 2025, 4:05 PM Reply Quote 0
              • S Away
                sdetweil @evroom
                last edited by sdetweil Jan 18, 2025, 4:22 PM Jan 18, 2025, 4:05 PM

                @evroom the core function is the same
                i added the ability to have different page display times

                i wrote the doc on the fixed page name approach

                as you are using a notification now
                just move that to suspend (same as index=0)
                and the resume wakes you back up

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                P 1 Reply Last reply Jan 19, 2025, 2:31 AM Reply Quote 0
                • P Offline
                  plainbroke @sdetweil
                  last edited by Jan 19, 2025, 2:31 AM

                  @sdetweil
                  He has the MMM-MPlayer working in pages and I am now using pages and MPlayer in my main MM.
                  Kinda of cool to be able to show a RSTP camera or 2 again…

                  Slow learner. But trying anyways.

                  S 1 Reply Last reply Jan 19, 2025, 2:31 AM Reply Quote 0
                  • S Away
                    sdetweil @plainbroke
                    last edited by Jan 19, 2025, 2:31 AM

                    @plainbroke cool

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      mvrlogins @evroom
                      last edited by Feb 19, 2025, 4:16 PM

                      @evroom said in MMM-pages - how to know which page index my module has?:

                      As a workaround, I will make it a requirement to put the MMM-Player on the first page (page index 0).
                      When I receive 0, then I will start streaming, otherwise I will stop streaming.
                      That seems to work.

                      Hi

                      Trying to use the mmm-mplayer module with mmm-pages, and it works fine, as you say, when the page index is 0.

                      However, I’d like to use it to only show video when called via notification

                      I have a single main page (without mplayer) - that shows all the time - and a single hidden page (with mplayer) to be shown when called via notification and then return the the main page with another notification.

                      I can’t currently implement this. Any ideas?

                      Thanks very much

                      S 1 Reply Last reply Feb 19, 2025, 5:01 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 1 / 3
                      • 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