Read the statement by Michael Teeuw here.
Run two instances of the same module (sometimes) Tutorial
-
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:
-
Make a copy of the module folder that you want to run twice. (Ex - MMM-Module)
-
Rename the folder of the copy to MMM-Module2.
-
Open the MMM-Module2 folder that you just renamed.
-
Rename the MMM-Module.js file to MMM-Module2.js
-
Open the MMM-Module2.js file.
-
Change the Module.register line to
Module.register("MMM-Module2", {
. -
Change the
getStyles: function
to
getStyles: function() { return ["MMM-Module2.css"] },
-
Save the MMM-Module2.js file you just edited and close.
-
Open the MMM-Module2 folder.
-
Rename the MMM-Module.css file to MMM-Module2.css.
-
Open the MMM-Module2.css file.
-
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; }
-
Save the MMM-Module2.css file and close.
-
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!
-
-
-
@Mykle1 Worked first time for the MMM_DateCounter module. Thank you!!