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

Run two instances of the same module (sometimes) Tutorial

Scheduled Pinned Locked Moved Troubleshooting
2 Posts 2 Posters 1.0k 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
    Mykle1 Project Sponsor Module Developer
    last edited by Mar 2, 2021, 2:06 AM

    Not all modules can run two instances by just adding a second config entry with different values. Some modules, NOT ALL, can be “tricked” into running two instances with different values. Here’s how:

    1. Make a copy of the module folder that you want to run twice. (Ex - MMM-Module)

    2. Rename the folder of the copy to MMM-Module2.

    3. Open the MMM-Module2 folder that you just renamed.

    4. Rename the MMM-Module.js file to MMM-Module2.js

    5. Open the MMM-Module2.js file.

    6. Change the Module.register line to Module.register("MMM-Module2", {.

    7. Change the getStyles: function to

    getStyles: function() {
            return ["MMM-Module2.css"]
        },
    
    1. Save the MMM-Module2.js file you just edited and close.

    2. Open the MMM-Module2 folder.

    3. Rename the MMM-Module.css file to MMM-Module2.css.

    4. Open the MMM-Module2.css file.

    5. Rename the module names to reflect the new module name. Your class names will be different. Just change the module names:

    .MMM-Module2 .header {
      color: #50F8F4;
      text-align: center;
      /*  display: none;
    }
     
    .MMM-Module2 .age {
      color: #white;
      text-align: center;
      /*  display: none;
    }
    
    .MMM-Module2 .females {
      color: #ff69b4;
      text-align: center;
    /*  display: none;
    }
    
    
    1. Save the MMM-Module2.css file and close.

    2. Now make another entry into the config.js file using MMM-Module2 as the module name and change your values.

    Remember

    This doesn’t always work but many users have had success this way, including myself.

    About API calls

    If the module you are duplicating uses an API key, you are effectively doubling the calls to that API. This might lead to hitting your call limit. In this case, you should consider raising the updateInterval for both modules to avoid being throttled by the API.

    Peace!

    Create a working config
    How to add modules

    L 1 Reply Last reply Dec 20, 2024, 1:03 PM Reply Quote 1
    • L luisestrada referenced this topic on Jun 6, 2022, 9:31 PM
    • L Offline
      lostagain @Mykle1
      last edited by Dec 20, 2024, 1:03 PM

      @Mykle1 Worked first time for the MMM_DateCounter module. Thank you!!

      1 Reply Last reply Reply Quote 0
      • B bibelo referenced this topic 7 days ago
      • 1 / 1
      1 / 1
      • First post
        1/2
        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