MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord
    MagicMirror² v2.20.0 is available! For more information about this release, check out this topic.

    SOLVED Default Weather Module Multiple Instances for Diff Locations

    Troubleshooting
    2
    5
    132
    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.
    • K
      kayakbabe last edited by

      Re: Default Modules

      I found that I can use the new weather module many times for different locations.
      I"m building a mirror for my Dad and he likes to watch the weather in different cities where his family members are located.

      I would like to be able to do this on different “pages” using the pages module. I setup a PiSupply Flick Large to do the page incrementing and it’s working great. So, ideally I’d have his local weather on page 1 and on page 2 have about five weather locations for the family.

      How would I do this? Would I have to copy and rename the weather module?

      S 1 Reply Last reply Reply Quote 0
      • K
        kayakbabe @sdetweil last edited by

        @sdetweil I finally got it! Your hint on another forum post plus this… finally made sense to me after I stared at it a while.

        for anyone else…

        1. The pages module works on class names not actual module names.
        2. MagicMirror uses the module name as the default css class for that module.
        3. you don’t have to use the default class name in the pages module config, you can use the additional class you gave it instead.

        so parts of my config now look like this:

        {	
        			module: "weather",
        			classes: "nbweather",
        			position: "top_right",
        			config: {
        				weatherProvider: "openweathermap", 
        				type: "current",
        				location: "New Braunfels",
        				locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
        				apiKey: "xxxxxxxxxxxxx"
        			}
        		},
        		{
        			module: "weather",
        			classes: "nbweather",
        			position: "top_right",
        			header: "Weather Forecast",
        			config: {
        				weatherProvider: "openweathermap",
        				type: "forecast",
        				colored: true,
        				showPrecipitationAmount: true,
        				location: "New Braunfels",
        				locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
        				apiKey: "xxxxxxxxxxxxxxxxxxxxxx"
        			}
        		},
        		{	
        			module: "weather",
        			position: "top_right",
        			classes: "altusweather",
        			header: "Altus Weather",
        			config: {
        				weatherProvider: "openweathermap", 
        				type: "current",
        				location: "Altus",
        				locationID: "4529292", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
        				apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxx"
        			}
        		},
        

        and the config section for my pages module looks like this:

        		module: 'MMM-pages',
        		config: {
        				modules:
        					[[ "clock", "calendar", "nbweather", "compliments"],
        					 [ "clock","MMM-SolarPicture","MMM-APOD","MMM-NewsAPI"],
        					 [ "altusweather","MMM-MyScoreboard"]
        					],
        

        As you can see I used the class I gave each instance of the module instead of the module’s default class name.

        S 1 Reply Last reply Reply Quote 0
        • S
          sdetweil @kayakbabe last edited by

          @kayakbabe the easiest way is to assign a ‘class’ to each module on a page
          page1
          page2
          page3
          etc

          then use the classname as the thing in the pages config

          modules: [
                 [   'page1' ],
                 [   'page2' ],
                 [  'page3'  ]
                ]
          

          in each module definition
          module: ‘weather’,
          classes:‘page1’,

          etc

          Sam

          Create a working config
          How to add modules

          K 1 Reply Last reply Reply Quote 0
          • K
            kayakbabe @sdetweil last edited by

            @sdetweil I finally got it! Your hint on another forum post plus this… finally made sense to me after I stared at it a while.

            for anyone else…

            1. The pages module works on class names not actual module names.
            2. MagicMirror uses the module name as the default css class for that module.
            3. you don’t have to use the default class name in the pages module config, you can use the additional class you gave it instead.

            so parts of my config now look like this:

            {	
            			module: "weather",
            			classes: "nbweather",
            			position: "top_right",
            			config: {
            				weatherProvider: "openweathermap", 
            				type: "current",
            				location: "New Braunfels",
            				locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
            				apiKey: "xxxxxxxxxxxxx"
            			}
            		},
            		{
            			module: "weather",
            			classes: "nbweather",
            			position: "top_right",
            			header: "Weather Forecast",
            			config: {
            				weatherProvider: "openweathermap",
            				type: "forecast",
            				colored: true,
            				showPrecipitationAmount: true,
            				location: "New Braunfels",
            				locationID: "4714131", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
            				apiKey: "xxxxxxxxxxxxxxxxxxxxxx"
            			}
            		},
            		{	
            			module: "weather",
            			position: "top_right",
            			classes: "altusweather",
            			header: "Altus Weather",
            			config: {
            				weatherProvider: "openweathermap", 
            				type: "current",
            				location: "Altus",
            				locationID: "4529292", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
            				apiKey: "xxxxxxxxxxxxxxxxxxxxxxxxx"
            			}
            		},
            

            and the config section for my pages module looks like this:

            		module: 'MMM-pages',
            		config: {
            				modules:
            					[[ "clock", "calendar", "nbweather", "compliments"],
            					 [ "clock","MMM-SolarPicture","MMM-APOD","MMM-NewsAPI"],
            					 [ "altusweather","MMM-MyScoreboard"]
            					],
            

            As you can see I used the class I gave each instance of the module instead of the module’s default class name.

            S 1 Reply Last reply Reply Quote 0
            • S
              sdetweil @kayakbabe last edited by sdetweil

              @kayakbabe but. even EASIER

              for the modules u want one page 1
              set ALL of their classes to ‘page1’

              then your pages config says

              all modules w page1 class go on 1st page

              don’t have to list them individually.

              and if u change your mind, then u change the module classes, NOT the pages config

              Sam

              Create a working config
              How to add modules

              K 1 Reply Last reply Reply Quote 1
              • K
                kayakbabe @sdetweil last edited by

                @sdetweil I got it! That makes even more sense! Thanks!

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy