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

Made a birthday module

Scheduled Pinned Locked Moved Entertainment
39 Posts 4 Posters 3.5k Views 5 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.
  • C Offline
    cgillinger @plainbroke
    last edited by cgillinger Feb 3, 2025, 7:39 PM Feb 3, 2025, 7:21 PM

    I THINK I’ve solved it. At least, it works on my test installation MagicMirror running on Linux Mint. I’ve tested it with MMM-Pages and MMM-Carousel, and now the transitions are working. However, there are a few things to note:

    It looks really weird when you first start MagicMirror. The reason is that the system starts up, immediately detects that a birthday is happening, and then triggers an untimed startup where the module isn’t fully initialized yet. It sorts itself out after the first transition, and since it’s somewhat of an edge case to start from scratch, I haven’t spent time fine-tuning it. A more reasonable scenario is that MagicMirror runs continuously, the day changes, and then the birthday event occurs—where everything works as expected.

    I wasn’t able to make the module overlay existing modules while dimming them slightly, as it did in my first version. This is due to the fact that my initial solution aggressively took control over the display. To make it work with Pages and Carousel while respecting their handling of module visibility, I had to take a different approach. This means that the module now displays on its own. Im going to look into how this might be solved next, I’d really like for it to show above the other modules of that page. Because of this, I had to rename it and treat it as a completely separate module, now called “MMM-Birthday-Paged”. I’ll also mark the original module so that users who rely on module switchers don’t accidentally pick the wrong one.

    As a bonus, after all my tweaking, I ended up with several different fireworks effects, so I left them in a separate subfolder. If you want to test them, just copy the existing “fireworks.js” from the root directory.

    Give it a try, and I hope it works for you too!

    URL:
    https://github.com/cgillinger/MMM-Birthday-Paged

    S 1 Reply Last reply Feb 3, 2025, 7:47 PM Reply Quote 0
    • S Offline
      sdetweil @cgillinger
      last edited by Feb 3, 2025, 7:47 PM

      @cgillinger instead of using the start function directly

      Use the ALL_MODULES_STARTED notification
      Then call your renamed startup() function

      See https://docs.magicmirror.builders/development/notifications.html#system-notifications

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      1 Reply Last reply Reply Quote 1
      • X Offline
        xIExodusIx
        last edited by Feb 3, 2025, 8:59 PM

        Hi cgillinger,

        I tested your new modul, MMM-Birthday-Paged, sadly it does not work for me, it should shown up on my MagicMirror on Page 1 with a lot of more informations, it does, firework and confetti work well, but it kills all of my other Informations on that page and the icons in front and back of the “gratulation text” will not be displayed, exactly as mentioned in my post some Days earlier.
        For me this version of yor Modul must have its own Page.

        C 1 Reply Last reply Feb 4, 2025, 8:30 AM Reply Quote 0
        • C Offline
          cgillinger @xIExodusIx
          last edited by Feb 4, 2025, 8:30 AM

          @xIExodusIx On the first issue, that is, currently, by design as I outline in my previous post. I’m looking into if there is a method to fix it, but Im not there yet.

          On the second issue that sounds like a font problem. What system are you on?

          1 Reply Last reply Reply Quote 0
          • X Offline
            xIExodusIx
            last edited by Feb 4, 2025, 9:01 AM

            @cgillinger Hi cglinger,

            I’m using a Raspberry Pi 4B 4GB with RaspiOS Bookworm
            MM Version is 2.30,
            npm Version is 10.9.2,
            node Version is 23.6.1.

            I hope this would help.

            C 1 Reply Last reply Feb 4, 2025, 12:17 PM Reply Quote 0
            • C Offline
              cgillinger @xIExodusIx
              last edited by Feb 4, 2025, 12:17 PM

              @xIExodusIx said in Made a birthday module:

              I’m using a Raspberry Pi 4B 4GB with RaspiOS Bookworm
              MM Version is 2.30,
              npm Version is 10.9.2,
              node Version is 23.6.1.

              I think RaspiOS is missing the font. It might be solved by issuing:

              sudo apt update
              sudo apt upgrade -y
              sudo apt install -y fonts-noto-color-emoji fonts-symbola ttf-ancient-fonts
              

              and then rebuild font cache

              sudo fc-cache -f -v
              

              Then restarting Magic Mirror and/or Pi.

              And if I get the time, Ill look into a more elegant solution.

              X 1 Reply Last reply Feb 4, 2025, 1:37 PM Reply Quote 0
              • X Offline
                xIExodusIx @cgillinger
                last edited by Feb 4, 2025, 1:37 PM

                @cgillinger said in Made a birthday module:

                @xIExodusIx said in Made a birthday module:

                I’m using a Raspberry Pi 4B 4GB with RaspiOS Bookworm
                MM Version is 2.30,
                npm Version is 10.9.2,
                node Version is 23.6.1.

                I think RaspiOS is missing the font. It might be solved by issuing:

                sudo apt update
                sudo apt upgrade -y
                sudo apt install -y fonts-noto-color-emoji fonts-symbola ttf-ancient-fonts
                

                and then rebuild font cache

                sudo fc-cache -f -v
                

                Then restarting Magic Mirror and/or Pi.

                And if I get the time, Ill look into a more elegant solution.

                Thank you :-) , this solved my problem with the funny Icons in front and then end of the text.

                Now the last problem(s) is to tell your Module not to hijack the whole page for itself and not to ignore the position where to be displayd on the mirror.
                Your Module is really great, because there is a little bit of (funny) action on the mirror :-)
                I’m sure you will solve the two Problems too an I’m looking forward for that. :-)

                C 1 Reply Last reply Mar 15, 2025, 11:00 AM Reply Quote 0
                • C Offline
                  cgillinger @xIExodusIx
                  last edited by cgillinger Mar 15, 2025, 12:58 PM Mar 15, 2025, 11:00 AM

                  @xIExodusIx I believe I’ve solved the issue where MMM-Birthday-Pages was taking over the entire screen when active. There’s now a new toggle, immersiveMode, which can be set to either “true” or “false”.

                  "false" allows the birthday celebration to overlay existing modules while keeping them visible.
                  "true" means only the birthday celebration is displayed, hiding everything else.
                  

                  This also means you can have different behaviors on different Pages.

                  That said, I’ve only had time for a quick test, and it worked as expected on my Linux Mint installation. To be safe, I’ve uploaded it to a separate test repository. If it proves to be stable, I’ll merge it into the main one (I’m sure there are easier ways to do this, but I suck at Git). Repo URL:
                  https://github.com/cgillinger/mmm-Birthday-paged-test (and please note that you need to rename the folder to “mmm-Birthday-paged” after cloning)

                  So, give it a try and let me know how it goes!

                  X 1 Reply Last reply Mar 15, 2025, 8:14 PM Reply Quote 0
                  • X Offline
                    xIExodusIx @cgillinger
                    last edited by Mar 15, 2025, 8:14 PM

                    @cgillinger
                    Hi cgillinger,
                    I installe your new module “MMM-Birthday-Pages-test” as described, and added the “immersiveMode” to the MM2 main config file.
                    It seems to work partly, it accepted the positon, on my MM2 “lower_third”, but it ignores the page and it shows some debug informations with green text on the left side by partly hiding the funny icon and parts of the gratulation text.
                    The fireworks is displayd on fullscreen but in my short test i can’t see the confetti.

                    A little idea for make it for user a bit easier: make it possible to set the firworks in the MM2 main config-file instead to copy it from to… somthing like “Fireworks: “spiral”” and let it load directly out of the of the “…/fireworks/” folder instead to copy it to the MMM-Birthday-Paged folder.

                    I will install the “old” MMM-Birthday-paged" and install it as I had it before. It has its own page on my MM2, and it worked very well.

                    C 1 Reply Last reply Mar 16, 2025, 10:21 AM Reply Quote 0
                    • C Offline
                      cgillinger @xIExodusIx
                      last edited by cgillinger Mar 16, 2025, 11:47 AM Mar 16, 2025, 10:21 AM

                      @xIExodusIx Hi!

                      First, the green debug code was displayed because I forgot to set it to “false” by default. You can change this in config.js, but I’ll update the default setting so it only appears when the user wants it (ie when setting “true” in config.js).

                      Second, the module still has some quirks in its startup behavior—it requires a full cycle before everything runs smoothly. I’m working on it, but to be honest, it’s a low-priority fix since it’s a fringe case. Typically, the module will be running continuously, so birthday initialization should trigger when the mirror is already active. That’s probably why you’re not seeing the confetti right away.

                      Third, regarding the different versions of Fireworks—absolutely! The reason there are multiple versions is simply that I left them in from my experiments. I didn’t originally plan to include that functionality, but once the core features are fully ironed out, I’d be happy to refine and expand on it.

                      As for positioning, the module is currently designed to use the entire screen. I might look into allowing more customization in the future, but for now, it just places the message in the center and then launches confetti and fireworks.

                      When you say it “ignores the page,” are you referring to the page cycling?

                      I’ve also attached my test config.js. It has three pages, and after cycling through them to align the timings, the expected behavior should be:

                      Page 1 – Normal modules
                      Page 2 – Birthday celebration with dimming
                      Page 3 – Birthday celebration without dimming
                      

                      Test config.js (which needs MMM-page-indicator). I’ve let this run for about an hour now, and everything (apart from weather module because its not part of the test) works as intended:

                      /* MagicMirror² Config for testing MMM-Birthday-Paged with immersiveMode */
                      let config = {
                          address: "localhost",
                          port: 8080,
                          basePath: "/", 
                          ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
                          useHttps: false, 
                          httpsPrivateKey: "", 
                          httpsCertificate: "", 
                      
                          language: "en",
                          locale: "en-US",
                          logLevel: ["INFO", "LOG", "WARN", "ERROR", "DEBUG"],
                          timeFormat: 24,
                          units: "metric",
                      
                          modules: [
                              {
                                  module: "alert",
                              },
                              {
                                  module: "clock",
                                  position: "top_left",
                                  classes: "page1 page3" // Show on page 1 and 3
                              },
                              {
                                  module: "calendar",
                                  header: "Holidays",
                                  position: "top_left",
                                  classes: "page1 page3", // Show on page 1 and 3
                                  config: {
                                      calendars: [
                                          {
                                              symbol: "calendar-check",
                                              url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"
                                          }
                                      ]
                                  }
                              },
                              {
                                  module: "weather",
                                  position: "top_right",
                                  classes: "page1 page3", // Show on page 1 and 3
                                  config: {
                                      weatherProvider: "yr",
                                      type: "current",
                                      location: "Stockholm",
                                      locationID: "2673730", // Stockholm's ID
                                      roundTemp: true
                                  }
                              },
                              {
                                  module: "compliments",
                                  position: "lower_third",
                                  classes: "page1 page3", // Show on page 1 and 3
                              },
                              // MMM-Birthday-Paged with immersiveMode = true (dims modules)
                              {
                                  module: "MMM-Birthday-Paged",
                                  position: "middle_center",
                                  classes: "page2", // Show on page 2
                                  config: {
                                      birthdays: [
                                          // Today's date (March 16, 2025) with name John
                                          { name: "John", date: "03-16" } 
                                      ],
                                      fireworkDuration: "infinite",
                                      confettiDuration: "infinite",
                                      immersiveMode: true, // Dims other modules
                                      debug: true,
                                      startupDelay: 500 // Shorter startup delay for testing
                                  }
                              },
                              // MMM-Birthday-Paged with immersiveMode = false (original module behavior)
                              {
                                  module: "MMM-Birthday-Paged",
                                  position: "middle_center",
                                  classes: "page3", // Show on page 3
                                  config: {
                                      birthdays: [
                                          // Today's date (March 16, 2025) with name John
                                          { name: "John", date: "03-16" } 
                                      ],
                                      fireworkDuration: "infinite",
                                      confettiDuration: "infinite",
                                      immersiveMode: false, // Does NOT dim other modules
                                      debug: true,
                                      startupDelay: 500 // Shorter startup delay for testing
                                  }
                              },
                              // Page indicator to see which page is showing
                              {
                                  module: "MMM-page-indicator",
                                  position: "bottom_bar",
                                  config: {
                                      pages: 3
                                  }
                              },
                              // MMM-pages for page switching
                              {
                                  module: "MMM-pages",
                                  config: {
                                      modules: [
                                          ["page1"],   // Page 1 - Normal modules
                                          ["page2"],   // Page 2 - Birthday celebration with dimming
                                          ["page3"]    // Page 3 - Birthday celebration without dimming
                                      ],
                                      fixed: ["alert", "MMM-page-indicator"],
                                      rotationTime: 15000, // 15 seconds between page changes
                                      rotationDelay: 15000,
                                      animationTime: 1000
                                  }
                              }
                          ]
                      };
                      
                      /*************** DO NOT EDIT THE LINE BELOW ***************/
                      if (typeof module !== "undefined") {module.exports = config;}
                      
                      plainbrokeP 1 Reply Last reply Mar 21, 2025, 11:21 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 4 / 4
                      • 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