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

Default Weather Module Multiple Instances for Diff Locations

Scheduled Pinned Locked Moved Solved Troubleshooting
5 Posts 2 Posters 624 Views 2 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.
  • K Offline
    kayakbabe
    last edited by Jun 16, 2022, 4:38 AM

    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 Jun 16, 2022, 11:17 AM Reply Quote 0
    • K Offline
      kayakbabe @sdetweil
      last edited by Jun 17, 2022, 10:23 PM

      @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 Jun 17, 2022, 10:40 PM Reply Quote 0
      • S Away
        sdetweil @kayakbabe
        last edited by Jun 16, 2022, 11:17 AM

        @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

        How to add modules

        learning how to use browser developers window for css changes

        K 1 Reply Last reply Jun 17, 2022, 10:23 PM Reply Quote 1
        • K Offline
          kayakbabe @sdetweil
          last edited by Jun 17, 2022, 10:23 PM

          @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 Jun 17, 2022, 10:40 PM Reply Quote 0
          • S Away
            sdetweil @kayakbabe
            last edited by sdetweil Aug 28, 2022, 10:52 AM Jun 17, 2022, 10:40 PM

            @kayakbabe but. even EASIER

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

            then your pages config says

                modules:[
                            [  "page1" ],
                            [  "page2" ]
                  ]
            

            all modules w page1 class property show together on the 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

            How to add modules

            learning how to use browser developers window for css changes

            K 1 Reply Last reply Jun 17, 2022, 11:19 PM Reply Quote 1
            • K Offline
              kayakbabe @sdetweil
              last edited by Jun 17, 2022, 11:19 PM

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

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