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.

    Multiple instances of MMM-DarkSkyForecast with MMM-pages

    Scheduled Pinned Locked Moved Solved Troubleshooting
    18 Posts 5 Posters 5.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.
    • FoziF Offline
      Fozi Project Sponsor @Clubjack
      last edited by

      @Clubjack I had recently exactly the same issue with MMM-ioBroker, where I needed 2 instances of that module running. Finally, after some research I found the solution and documented in my private Wiki. Here is the documentation I wrote. After setting up that 2nd instance you can configure each instance separately and declare it in MMM-pages.
      Here we go:

      Problem
      In some cases you may need to run 2 or more instances of the same module in MM, e.g. for public transportation. Some MMMs can then be put into config.js just on a different position and parameterized as needed. Unfortunatelly, not all MMMs support that.
      The reason is that all those instances will share the same node_helper and therefore get the same socketnotifications.

      Solution
      To solve this problem you can try to duplicate the MMM with a different name and call it in the config.js. There is no guarantee that it works, but worth to try.

      Following steps have to be done:

      1. Go to the modules folder and copy the whole module with a different name (in this example I’ll refer to MMM-ioBroker)
      $ cd ~/MagicMirror/modules
      $ cp -a MMM-ioBroker/ MMM-ioBroker2
      
      1. Go to ./MMM-ioBroker2 and change the .js of the module script accordingly
      $ mv MMM-ioBroker.js MMM-ioBroker2.js
      
      1. Edit in MMM-ioBroker2.js the string to
      Module.register('MMM-ioBroker2', {
      …
      
      1. In some cases it might also be necessary to change the .css file name, too, incl. any reference to the instance name in the file.
      $ mv MMM-ioBroker.css MMM-ioBroker2.css
      

      And then edit or replace all occurences of ‘MMM-ioBroker’ with ‘MMM-ioBroker2’ in MMM-ioBroker2.css.

      HowTo: Replace PIR Sensor with a RCWL-0516 Microwave Sensor

      C 2 Replies Last reply Reply Quote 1
      • C Offline
        Clubjack @Fozi
        last edited by

        @Fozi
        Thank You guy.
        I will test it at the weekend.
        That sounds good. 👍🏽

        1 Reply Last reply Reply Quote 0
        • C Offline
          Clubjack @Fozi
          last edited by

          @Fozi
          Tryed your way, but get some issues with the modules. Is it right that i must use mv and not cp for the namechange from the. js?

          S FoziF 2 Replies Last reply Reply Quote 0
          • S Offline
            sdetweil @Clubjack
            last edited by

            @Clubjack said in Multiple instances of MMM-DarkSkyForecast with MMM-pages:

            mv and not cp

            correct…

            mv is the rename

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 1
            • FoziF Offline
              Fozi Project Sponsor @Clubjack
              last edited by Fozi

              @Clubjack if you use ‘cp’ then the file is really copied under a new name. The original file will still exist.
              If you use ‘mv’ then the file will be renamed, there will no copy of that file.

              Thus use ‘mv’ to rename the files. Otherwise you’ll have two .js files in your module.

              Edit: @sdetweil was 10 sec. quicker than me:face_with_tears_of_joy:

              HowTo: Replace PIR Sensor with a RCWL-0516 Microwave Sensor

              1 Reply Last reply Reply Quote 0
              • C Offline
                Clubjack
                last edited by

                Thanks. But i think it dosnt work with this Module.

                1 Reply Last reply Reply Quote 0
                • 1
                • 2
                • 1 / 2
                • 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